Closed psydvl closed 6 months ago
Thanks for reporting this! I allowed io.EOF
from (io.ReadCloser).Read
.
The second example is a bit trickier as the allow-list works based on the name of the type. And since MyReader
is a custom type it is not known by the allow-list. A solution would involve checking whether the source function implements one of the allowed interfaces, but I have not attempted that yet.
Should we also expect same behavior for next types?
json.Decoder{}.Decode()
csv.Reader{}.Read()
ReadAll()
mime/multipart.Reader{}.NextPart()
https://github.com/search?q=repo%3Agolang%2Fgo+%22func+Example%22+%22%3D%3D+io.EOF%22&type=code
Yes, any function in the standard library that returns io.EOF is ok to allow
Fixed in d1fbedb7e97b9da420a6e9ad88f9afdeb48f09ee
However, this can be solved somehow with the whitelisting that follows interface embedding
Example:
Both raise
comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error