golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.88k stars 17.52k forks source link

Reopen #15656: encoding/base64: wrongly decodes bad base64 as valid #60090

Closed zamicol closed 1 year ago

zamicol commented 1 year ago

The previous issue is currently frozen due to age:

https://github.com/golang/go/issues/15656

I'll comment on that if it is unfrozen (So this issue I'm opening right now can be deleted), but more details on why this is significant:

I believe RFC 4648 is perhaps misleading here. The problem is not related to padding as the padded string hOk= and hOl= have the same encoding issue as unpadded strings. Neither string when decoded throws an error in Go.

See this issue for why this problem is significant: https://github.com/Cyphrme/Coze/issues/18

ianlancetaylor commented 1 year ago

We believe that issue #15656 was fixed a long time ago. We aren't going to reopen it. Please explain here what the problem is, ideally with a test case that misbehaves. Thanks.

zamicol commented 1 year ago

Ah! Thank you. My mistake, I did not see the line @gopherbot gopherbot closed this as completed in 87b1aaa on Oct 11, 2016.

The Strict() behavior is correct: https://go.dev/play/p/4wG8jkB0gpS