fix(router): prevent OOM by enforcing size limits on HTTP request bodies - #1677
Open
safiya2610 wants to merge 1 commit into
Open
fix(router): prevent OOM by enforcing size limits on HTTP request bodies#1677safiya2610 wants to merge 1 commit into
safiya2610 wants to merge 1 commit into
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
safiya2610
force-pushed
the
fix-1641-oom-vulnerability
branch
from
August 21, 2026 13:24
936a6e1 to
c2672fb
Compare
safiya2610
force-pushed
the
fix-1641-oom-vulnerability
branch
3 times, most recently
from
August 24, 2026 04:24
17b8345 to
dfc34e0
Compare
Prevent unbounded memory allocation by wrapping io.ReadAll calls with an io.LimitReader of 10MB. Signed-off-by: safiya2610 <lci2023053@iiitl.ac.in>
safiya2610
force-pushed
the
fix-1641-oom-vulnerability
branch
from
August 24, 2026 04:27
dfc34e0 to
c937510
Compare
Contributor
Author
|
@LiZhenCheng9527 PTAL. |
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.
Description
Fixes #1641
This PR addresses a critical Denial of Service (DoS) vulnerability where unbounded user requests could exhaust router memory and cause the pod to crash (OOMKilled).
Previously, several HTTP handlers used
io.ReadAlldirectly on uncontrolled input streams without enforcing a maximum payload size. This PR mitigates the vulnerability by wrapping the incoming request bodies in anio.LimitReaderconfigured with a strict 10MB limit before reading them into memory.Changes Made
pkg/kthena-router/router/router.go: Wrappedc.Request.Bodyandreq.Bodywithio.LimitReader(10MB) inParseModelRequestandproxyModelEndpoint.pkg/kthena-router/handlers/request.go: Wrappedr.Bodywithio.LimitReader(10MB) inParseOpenAIRequestBody.pkg/kthena-router/webhook/utils.go: Wrappedr.Bodywithio.LimitReader(10MB) inparseAdmissionReviewFromRequest.