Skip to content

fix(auth): reject non-ASCII API-key input without request-time TypeError - #543

Draft
seonghobae wants to merge 6 commits into
mainfrom
fix-api-key-utf8-12987541694327418735
Draft

fix(auth): reject non-ASCII API-key input without request-time TypeError#543
seonghobae wants to merge 6 commits into
mainfrom
fix-api-key-utf8-12987541694327418735

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Finding

require_api_key() passed Python str values directly to hmac.compare_digest. CPython rejects non-ASCII strings in that mode with TypeError, so a malformed/non-ASCII X-API-Key could 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

  • protected/base: main@47c6fd27de13b0da37a7db64697b869941909351
  • exact head: 14a34a5c19833640bc205b5205401afefcd271da
  • lifecycle: Draft / source+regression retained / deleted gap baseline repaired / exact-head gates queued

The 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 ordinary 401 {"error":"Invalid or missing API key"} response.

Intervening-delta repair

Verified predecessor 2ad8c8262f7f0a994fa74004d7c2e70456895309 also carried docs/product-technical-gap-baseline.md. Ordinary child 4f010e19f88b9d35a582d4acad96a3defeaf9026 retained 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 14a34a5c19833640bc205b5205401afefcd271da restores the baseline and updates it to the live evidence boundary. The document records authentication invariants, the raw CODEC_CARVER_API_KEYS runtime-secret deviation already identified by AGENTS.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, fuzz 34280073346, Security 34280073357, SAST 34280073394, and CodeQL PR 34280073331 are queued at the latest fresh read. No predecessor result transfers.

For context only, predecessor 4f010e19... had CI 34166584709, fuzz 34166584713, Security 34166584732, and SAST 34166584700 terminal GREEN while CodeQL PR 34166584717 was 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.

@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as draft September 7, 2026 22:07
@seonghobae seonghobae changed the title 🛡️ Sentinel: [MEDIUM] non-ASCII API 키에 대한 500 에러 수정 fix(auth): reject non-ASCII API-key input without request-time TypeError Sep 7, 2026
@seonghobae seonghobae added bug Something isn't working priority: high High-priority or P1 work labels Sep 8, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: high High-priority or P1 work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant