-
Notifications
You must be signed in to change notification settings - Fork 101
Enforce size limit on POST /api/fleet/uploads
#6159
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
base: main
Are you sure you want to change the base?
Conversation
|
This pull request does not have a backport label. Could you fix it @ycombinator? 🙏
|
pzl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
pointed out a few places where names or messages were unclear if it was describing large files (.i.e. a file itself being like 3GB with config set lower, and either rejecting file body bytes above that; or when reading this json file-description payload, looking at file.size property and rejecting for that limit). Whereas this is the limit placed on the total JSON payload body of file metadata / header.
The diff in isolation is clear which is being addressed, but down the road I can see this being an easy mixup, which thing is "too large": the file contents itself or the start / header payload.
| kind: security | ||
|
|
||
| # Change summary; a 80ish characters long description of the change. | ||
| summary: Enforce payload size limit, when configured, for file uploads |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"which limit" confusion here
| }`, | ||
| }, | ||
| { | ||
| "file that is too large is rejected", http.StatusRequestEntityTooLarge, "payload is too large", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"which limit" confusion in test description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pzl is correct, this is the upload start request
| return &y | ||
| } | ||
|
|
||
| func generateLargeFileInput(paddingSize int) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper fn name may also be confusing -- not a large file per se, but that is something tested elsewhere
| kind: security | ||
|
|
||
| # Change summary; a 80ish characters long description of the change. | ||
| summary: Enforce payload size limit, when configured, for file uploads |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| summary: Enforce payload size limit, when configured, for file uploads | |
| summary: Enforce UploadBegin request body size |
What is the problem this PR solves?
// Please do not just reference an issue. Explain WHAT the problem this PR solves here.
This PR prevents request bodies of arbitrarily large size to be sent to the
POST /api/fleet/uploadsAPI.How does this PR solve the problem?
// Explain HOW you solved the problem in your code. It is possible that during PR reviews this changes and then this section should be updated.
This PR checks the size of the request body sent to the
POST /api/fleet/uploadsAPI and, if it exceeds the configured limit, rejects the request, responding with an HTTP 413 Request Entity Too Large status code. By default, the limit is configured to 5MiB but can be overridden in the Fleet Server input configuration via theserver.limits.upload_start_limit.max_body_byte_sizesetting.How to test this PR locally
Design Checklist
Checklist
./changelog/fragmentsusing the changelog toolRelated issues