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

Set a max size for the logql parser to 5k. #3471

Merged
merged 2 commits into from
Mar 12, 2021

Conversation

cyriltovena
Copy link
Contributor

The API anyway receives the query via querystring which is normally max out by 2k based on RFC2616.
This will improve fuzzing too.

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

The API anyway receives the query via querystring which is normally max out by 2k based on RFC2616.
This will improve fuzzing too.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@@ -22,6 +23,8 @@ var parserPool = sync.Pool{
},
}

const maxInputSize = 5120
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 5K?

Suggested change
const maxInputSize = 5120
const maxInputSize = 5 * (1 << 10) // 5K

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5k is mostly arbitrary, the max a query param should be in a URL is 2k so this was a number bigger than that but still with some extra room

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge nothing enforces that 2KB limit; also I believe one can POST queries which removes that consideration.

Copy link
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slim-bean slim-bean merged commit 64decdb into grafana:master Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants