jws/jwe: split token into fixed number of parts#1308
jws/jwe: split token into fixed number of parts#1308lestrrat merged 1 commit intolestrrat-go:develop/v3from
Conversation
this avoid to use eccessive memory when processing maliciously crafted tokens with a large number of '.' characters Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
|
@drakkan If this is done for safety, I wonder if using For example input := []byte("one.two.three")
expectedSegments := 3
split := bytes.SplitN(input, []byte{'.'}, expectedSegments+1)
if len(split) != expectedSegments {
return ...
} |
|
@drakkan Oh, I think I get it. You want to avoid creating that extra slice of bytes, which could contain potentially very large amounts of garbage. I guess in that case Count would be better. |
this avoid to use eccessive memory when processing maliciously crafted tokens with a large number of '.' characters Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
yes, thank you. The Go project and also jose reported this as a security issue. I think it's a bit excessive but if possible a new version with the fix would help (I'm fine using an unreleased tag until this will happen). Thanks in advance |
this avoid to use eccessive memory when processing maliciously crafted tokens with a large number of '.' characters.
See also:
golang/go#71490
GHSA-c6gw-w398-hv78