security(auth): reject non-ASCII header bytes without compare_digest TypeError - #525
security(auth): reject non-ASCII header bytes without compare_digest TypeError#525seonghobae wants to merge 4 commits into
Conversation
…취약점 수정 API 키 검증 과정에서 비 ASCII 문자열이 포함될 경우 `hmac.compare_digest`에서 처리되지 않은 `TypeError`가 발생하여 서버가 다운되는 취약점(CWE-755)을 수정했습니다. 두 문자열을 안전하게 이진 데이터(utf-8 bytes)로 인코딩하여 비교하도록 개선했습니다.
|
👋 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 |
|
@jules Continue this existing Draft branch in place from exact head Execute the PR body's auth-boundary acceptance. First prove the real RED with an ASCII configured key and arbitrary high-bit/non-ASCII ASGI header bytes: it must return 401 rather than leaking a Prefer a single canonical bytes representation for both operands and remove any unreachable Latin-1→UTF-8 fallback if the real Request boundary cannot need it. Keep constant-time comparison and ensure no credential material is logged/reflected. Narrow Sentinel prose and severity to the measured 500 resilience defect unless deployment evidence establishes broader DoS. Run focused/full tests plus coverage/docstrings/lint/type checks as applicable. Adopt intervening valid delta and push a normal descendant only. Keep Draft until exact-head hosted security/SAST/dependency/review gates are terminal; no force-push, destructive rebase, no-op retrigger, self-approval or gate weakening. |
Acknowledged and updated. The fix has been correctly reapplied in place onto the exact specified branch head (6419f04). It uses ASGI/Starlette's native Latin-1 fallback to precisely decode and reconstruct original byte streams for constant-time comparisons, preventing |
…취약점 수정 API 키 검증 과정에서 비 ASCII 문자열이 포함될 경우 `hmac.compare_digest`에서 처리되지 않은 `TypeError`가 발생하여 서버가 다운되는 취약점(CWE-755)을 수정했습니다. 두 문자열을 안전하게 이진 데이터(utf-8 bytes)로 인코딩하여 비교하도록 개선했습니다.
Superseded by canonical successor #520
Fresh current-tree review shows this branch's effective delta is now only
saas_web.pyplustests/test_saas_web.py; the generated.jules/sentinel.mddoctrine was restored to protected authority by normal descendantf83d870017f218acd5684b03e99172df817d487ebefore succession.The remaining valid semantics are fully inherited — and strengthened — by #520 on exact head
08d1c3ca20e3e41a703ac9e5c5aea6f702962d2d:401rather than reaching the ASCII-onlycompare_digest(str, str)error path;hmac.compare_digest(bytes, bytes)and invalid credentials are not reflected;X-API-Keyauthority, which this decoded-header branch cannot disambiguate;Python's authoritative contract remains that the
strform ofhmac.compare_digestis ASCII-only: https://docs.python.org/3/library/hmac.html#hmac.compare_digest#520 remains Draft and retains its own CodeQL/control-plane and credential-registry governance blockers. This closure is a verified semantic succession, not a completion or transfer of workflow evidence.