Skip to content
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

Token limit fix CVE-2023-49559 #291

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

uvzz
Copy link

@uvzz uvzz commented Jan 11, 2024

Hi,

I added a default token limit value of 15000 and a token count inside next() function in parser.go

the limit should be configured by callers of the parser (i.e. gqlgen, genqlient, etc.). - Can you assist with that?

@uvzz uvzz changed the title Token limit fix CVE 2023 49559 Token limit fix CVE-2023-49559 Jan 11, 2024
@coveralls
Copy link

coveralls commented Jan 11, 2024

Coverage Status

coverage: 88.477% (-0.1%) from 88.575%
when pulling f1ffdaf on uvzz:token-limit-fix-CVE-2023-49559
into 591c98b on vektah:master.

@benjaminjkraft
Copy link
Contributor

This doesn't seem to let callers set the token limit? All the structs in question are private. We will need to figure out how to wire it in, which is a bit painful since there is no existing options API.

One kind of strange way is to make it a field of Source. It's a bit weird at first blush but it actually kinda makes sense that the parsing limit might vary from source to source. That wouldn't make it easy to set a default, and doesn't work for the main LoadQuery API -- but that one could have a default and callers who care could use ParseQuery + Validate, I think?

BTW, my opinion is still that this should be off by default; it is not a vulnerability for a parser to parse what you give it in its entirety, only for an HTTP server to parse input from the network with no limitations. (And I'm still unconvinced that request body size is not a sufficient limitation!) But I understand others might feel differently, so as long as it's possible to disable I'm fine being outvoted on that one.

parser/parser.go Outdated Show resolved Hide resolved
parser/parser.go Outdated Show resolved Hide resolved
parser/query.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants