๐ก๏ธ Sentinel: [MEDIUM] hmac.compare_digest์ ๋น-ASCII ๋ฌธ์ ์ฒ๋ฆฌ ์ค๋ฅ (500 ์๋ฌ) ์์ - #495
๐ก๏ธ Sentinel: [MEDIUM] hmac.compare_digest์ ๋น-ASCII ๋ฌธ์ ์ฒ๋ฆฌ ์ค๋ฅ (500 ์๋ฌ) ์์ #495seonghobae wants to merge 7 commits into
Conversation
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
|
๐ 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. |
|
No actionable comments were generated in the recent review. ๐ โน๏ธ Recent review infoโ๏ธ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ๐ Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. ๐ WalkthroughWalkthrough
ChangesAPI ํค ๊ฒ์ฆ
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: โช Minimal ยท up to The change makes non-ASCII X-API-Key values return HTTP 401 instead of HTTP 500 without altering the authentication boundary or deployment behavior. No actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
๐ฅ Pre-merge checks | โ 4 | โ 1โ Failed checks (1 warning)
โ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)
โจ Finishing Touches ๐ก 2๐ Generate docstrings ๐ก
๐ ๏ธ Fix failing CI checks ๐ก
๐งช 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 |
There was a problem hiding this comment.
๐ Info: Env-based API key reading remains the documented anti-pattern
AGENTS.md marks the CODEC_CARVER_API_KEYS env read in get_configured_api_keys as a known deviation to migrate to the credential registry. This PR edits the auth path but leaves that runtime env read in place.
(Refers to this code)
Was this helpful? React with ๐ or ๐ to provide feedback.
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
hmac.compare_digest ํจ์๋ ASCII ๋ฒ์ ์ธ์ ๋ฌธ์์ด์ด ์ฃผ์ด์ก์ ๋ TypeError๋ฅผ ๋ฐ์์ํค๋ฉฐ, ์ด๋ก ์ธํด ์ฌ์ฉ์๊ฐ X-API-Key ํค๋์ ๋น-ASCII ๋ฌธ์๋ฅผ ์ ์กํ๋ฉด 500 ์๋ฌ๊ฐ ๋ฐํ๋์ด DoS ๊ณต๊ฒฉ์ ์์ธ์ด ๋ ์ ์์ต๋๋ค. ์ด ์ปค๋ฐ์ ๋ ์ ๋ ฅ ๋ฌธ์์ด์ ๋ชจ๋ utf-8 ๋ฐ์ดํธ๋ก ์ธ์ฝ๋ฉํ ๋ค์ hmac.compare_digest๋ฅผ ํธ์ถํ๋๋ก ๊ฐ์ ํ์ฌ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ณ ์ ์์ ์ผ๋ก 401 Unauthorized๋ฅผ ๋ฐํํ๋๋ก ์์ ํฉ๋๋ค. ๊ด๋ จ ๋จ์ ํ ์คํธ๋ ์ถ๊ฐ๋์์ต๋๋ค.
Verified succession
Exact predecessor
cbc5b2d386ca24049116ff3871134681d8a404ca๋ decoded API-key ๋ฌธ์์ด์ UTF-8 bytes๋ก ๋ฐ๊พธ๊ณ emoji mismatchโ401 regression ๋ฐ ๊ฐ์ encoding ์ง์นจ์ ์ถ๊ฐํฉ๋๋ค. Canonical #520 exactcf730d007543ee828b7b8e77c9473288924047d4๋ raw ASGIX-API-Keybytes๋ฅผ configured UTF-8 key์ ์ง์ ๋น๊ตํ์ฌ ๋์ผ invalid non-ASCII rejection์ ๋ณด์กดํ๊ณ , valid Unicode credential success์ duplicate-header fail-closed๊น์ง ๋ ๊ฐํ๊ฒ ๊ฒ์ฆํฉ๋๋ค.๋ฐ๋ผ์ predecessor์ ์ ํจ behavior/test contract๋ #520์ ์์ ์น๊ณ๋์ต๋๋ค. decoded framework string ์ฌ์ธ์ฝ๋ฉ๊ณผ blanket encoding ์ง์นจ์ Unicode credential byte identity๋ฅผ ํผ์ํ ์ ์์ด ๋ณ๋ ์ ํจ delta๊ฐ ์๋๋ฉฐ canonical guidance๋ raw-header boundary๋ก ๊ต์ ํ์ต๋๋ค. #520์ protected
main@90717c6e9954bf3b7a351137995ebe89975e46c2๋๋นbehind_by=0์ธ non-force descendant์ ๋๋ค.