π‘οΈ Sentinel: [HIGH] Fix Rate Limit Bypass & Exhaustion DoS#653
π‘οΈ Sentinel: [HIGH] Fix Rate Limit Bypass & Exhaustion DoS#653arumes31 wants to merge 1 commit into
Conversation
This commit removes the `getRD` helper function in `internal/handlers/auth.go` and replaces all usages with `c.QueryParam("rd")`.
The `getRD` function conditionally fell back to `c.FormValue("rd")`, which inadvertently triggered body parsing even during fast-path early rate-limiting checks. This defeated the exhaustion DoS protection by forcing the server to buffer and parse large payloads before rejecting the request. The application templates already pass `rd` in the query string of the form action, making body parsing unnecessary.
Co-authored-by: arumes31 <114224498+arumes31@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the βοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
π¨ Severity: HIGH
π‘ Vulnerability: A fast-path rate limit implementation attempting to avoid parsing
c.FormValue()(which reads the request body and can cause exhaustion DoS with large payloads) was still indirectly parsing the form by using a globalgetRD()helper that calledc.FormValue().π― Impact: Attackers could bypass the fast-path protections and cause resource exhaustion (DoS) by sending excessively large POST payloads to the login endpoint, because the server would still buffer and parse the entire body before rejecting the throttled request.
π§ Fix: Removed the
getRDhelper function entirely and replaced it with direct calls toc.QueryParam("rd"). This strictly prevents body parsing during error response rendering. Therdstate is already maintained safely via the query string appended to the form action URL in the templates.β Verification: Ran
go test ./...which passes successfully, ensuring auth flows remain functional.PR created automatically by Jules for task 3477825865415276597 started by @arumes31