Repository navigation
x-pack/filebeat/input/http_endpoint: limit request body buffered for HMAC validation - #53937
Merged
Merged
Conversation
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
🔍 Preview links for changed docs |
Contributor
Elastic Docs Style Checker (Vale)Summary: 1 warning found
|
| File | Line | Rule | Message |
|---|---|---|---|
| docs/reference/filebeat/filebeat-input-http_endpoint.md | 304 | Elastic.BritishSpellings | Use American English spelling 'toward' instead of British English 'towards'. |
The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.
…HMAC validation When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total.
efd6
force-pushed
the
s11807-http_endpoint
branch
from
October 21, 2026 00:44
8f8716f to
5da33ee
Compare
efd6
marked this pull request as ready for review
October 21, 2026 02:12
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
kcreddy
approved these changes
Nov 3, 2026
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
This was referenced Nov 3, 2026
efd6
added a commit
that referenced
this pull request
Nov 12, 2026
…HMAC validation (#53937) When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total. (cherry picked from commit e178012)
efd6
added a commit
that referenced
this pull request
Nov 12, 2026
…HMAC validation (#53937) When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total. (cherry picked from commit e178012)
efd6
added a commit
that referenced
this pull request
Nov 12, 2026
…HMAC validation (#53937) When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total. (cherry picked from commit e178012)
efd6
added a commit
that referenced
this pull request
Nov 12, 2026
…HMAC validation (#53937) (#54391) When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total. (cherry picked from commit e178012) Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
efd6
added a commit
that referenced
this pull request
Nov 13, 2026
…HMAC validation (#53937) (#54389) When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total. (cherry picked from commit e178012) Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
efd6
added a commit
that referenced
this pull request
Nov 13, 2026
…HMAC validation (#53937) (#54390) When HMAC validation is configured, the whole request body is buffered so that the signature can be checked and the body replayed to the handler. That read had no limit unless max_body_bytes was set, and the bytes were not counted against max_in_flight_bytes, since the handler only wraps the body in its counting reader after validation. Limit the read to 25 MiB when max_body_bytes is not set. This is at least as large as the largest payload GitHub sends to webhooks, which it caps at 25 MB. Larger bodies are rejected with a 413 before the signature is checked. An explicit max_body_bytes keeps its existing behaviour. When max_in_flight_bytes is set, count the buffered bytes against it during validation and respond with a 503 and a Retry-After header, as the handler does when the limit is exceeded while reading. The in_flight value in that response is zero, since the bytes are released when validation returns. The request tracer reads the whole body of a rejected request to log it. Limit that read to what is logged, so that rejecting an oversized body does not buffer the rest of it. HMAC requests with bodies larger than 25 MiB and no max_body_bytes were previously accepted and are now rejected. The limit is per request; max_in_flight_bytes is what limits the total. (cherry picked from commit e178012) Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
1 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Note
The
applies_totags are only for 9.5+, but we'll have this coming in at a patch level. Please make sure I've done this correctly.Note
This has a potential impact on integrations that cannot set
max_body_bytes.Checklist
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
HTTP Endpoint inputs with HMAC validation and no
max_body_bytesnow reject request bodies over 25 MiB with a 413. Before, they accepted any size. Users who receive larger signed payloads should setmax_body_bytes. Whenmax_in_flight_bytesis set, the bytes read for HMAC validation count towards it, so a request that goes over it gets a 503 before its signature is checked, where before a bad signature got a 401. The Fleet integrations that use HMAC (http_endpoint,kolideand the deprecatedti_anomali.threatstream) don't exposemax_body_bytes, so their users can't raise the limit.How to test this PR locally
Related issues
Use cases
Screenshots
Logs