fix(auth): reject non-ASCII API-key input without request-time TypeError - #543
fix(auth): reject non-ASCII API-key input without request-time TypeError#543seonghobae wants to merge 6 commits into
Conversation
|
👋 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 Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
Finding
require_api_key()passed Pythonstrvalues directly tohmac.compare_digest. CPython rejects non-ASCII strings in that mode withTypeError, so a malformed/non-ASCIIX-API-Keycould turn an authentication failure into a request-time 500 instead of the normal 401 path.This is an input-handling/authentication-boundary defect. Current evidence does not justify broader claims of server-wide DoS or information disclosure.
Current exact repair
main@47c6fd27de13b0da37a7db64697b86994190935114a34a5c19833640bc205b5205401afefcd271daThe production boundary compares UTF-8 byte representations for both the provided value and configured keys while retaining
hmac.compare_digest. The regression sends a non-ASCII header through the actual middleware boundary and asserts the ordinary401 {"error":"Invalid or missing API key"}response.Intervening-delta repair
Verified predecessor
2ad8c8262f7f0a994fa74004d7c2e70456895309also carrieddocs/product-technical-gap-baseline.md. Ordinary child4f010e19f88b9d35a582d4acad96a3defeaf9026retained the source/test repair but deleted that canonical gap document. The deletion is a repair finding, not a reason to discard the useful authentication fix.Current ordinary descendant
14a34a5c19833640bc205b5205401afefcd271darestores the baseline and updates it to the live evidence boundary. The document records authentication invariants, the rawCODEC_CARVER_API_KEYSruntime-secret deviation already identified byAGENTS.md, lifecycle/rotation gaps, exact evidence ownership and the explicit rejection of server-wide CRITICAL/DoS claims unsupported by the demonstrated failure mode.Duplicate Jules PR #549 contained the same valid byte-wise comparison and non-ASCII 401 contract but added generated CRITICAL/DoS doctrine. Its valid delta is fully carried here; #549 was retired unmerged by ordinary descendant restoring the protected tree. No check or approval was transferred from that duplicate.
Exact-head checks
The document-restoration commit creates a new exact generation. CI
34280073410, fuzz34280073346, Security34280073357, SAST34280073394, and CodeQL PR34280073331are queued at the latest fresh read. No predecessor result transfers.For context only, predecessor
4f010e19...had CI34166584709, fuzz34166584713, Security34166584732, and SAST34166584700terminal GREEN while CodeQL PR34166584717was terminal FAILURE at the separately owned central receipt boundary. Those are historical RCA inputs, not current-head acceptance.Remaining acceptance
Keep Draft until one unchanged exact head has terminal-success then-live repository/security/SAST/fuzz/CodeQL evidence and qualifying independent current-head review/thread state. Do not reuse predecessor evidence, add source-neutral retrigger commits, self-approve, force-push, destructively rebase, synthesize statuses or weaken gates.
After this narrow input repair, the next security/product gap remains the credential aggregate/registry: encrypted-at-rest value, key identity/status/version, bootstrap import, rotation/revocation, purpose scope and audit evidence with no request-time raw environment secret read.