-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/base64: wrongly decodes bad base64 as valid #15656
Comments
Python 2.7.8 base64 module implements decoding the same way as
RFC4648 allows this. The relevant section is 3.5 (https://www.ietf.org/rfc/rfc4648.txt):
|
I suppose we could have some opt-in mechanism to be stricter, per the spec's "The specification referring to this may mandate a specific behaviour." I could imagine security applications demanding more strictness, for example. Maybe we add a method to base64.Encoding like: // Strict returns a strict encoding of e. It does not modify e.
func (e *Encoding) Strict() *Encoding {
....
} |
This sounds interesting to me. May I take over it? |
@xuyangkang, go for it. |
CL https://golang.org/cl/24964 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go1.6
go env
)?All operating systems.
https://play.golang.org/p/DiwWTDmGyC
Error for the second bad base64
Here err should be non 'nil'.
An example of ruby decoder throwing ArgumentError for similar conditions under RFC4648.
Success for the second bad base64.
The text was updated successfully, but these errors were encountered: