Skip to content

๐Ÿ›ก๏ธ Sentinel: [HIGH] hmac.compare_digest DoS ์ทจ์•ฝ์  ์ˆ˜์ • - #523

Closed
seonghobae wants to merge 1 commit into
mainfrom
sentinel-hmac-dos-fix-9823752132288418543
Closed

๐Ÿ›ก๏ธ Sentinel: [HIGH] hmac.compare_digest DoS ์ทจ์•ฝ์  ์ˆ˜์ •#523
seonghobae wants to merge 1 commit into
mainfrom
sentinel-hmac-dos-fix-9823752132288418543

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Verified succession

์ด generated branch์˜ ์œ ํšจํ•œ ์ œํ’ˆ ์š”๊ตฌ์‚ฌํ•ญ์€ "๋น„-ASCII/์ž„์˜ raw credential์ด API-key ์ธ์ฆ ๊ฒฝ๊ณ„์—์„œ ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์€ hmac.compare_digest(str, str) ์˜ˆ์™ธ๋ฅผ ๋งŒ๋“ค์ง€ ์•Š๊ณ  401๋กœ ๊ฑฐ์ ˆ๋˜์–ด์•ผ ํ•œ๋‹ค"๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํ•ด๋‹น ๊ณ„์•ฝ์€ canonical auth lane #520 exact 9ee46273ad9e7023af23cf88e19e6ee808840334์— ์™„์ „ ์Šน๊ณ„๋˜๊ณ  ๋” ๊ฐ•ํ•˜๊ฒŒ ๊ฒ€์ฆ๋ฉ๋‹ˆ๋‹ค.

#523 exact cc08a82005565b5483bd2b2a974195628465594f์˜ ์‹ค์ œ delta๋Š” ์„ธ ๊ฒฝ๋กœ๋ฟ์ž…๋‹ˆ๋‹ค.

  • saas_web.py: request.headers.get()์œผ๋กœ ์ด๋ฏธ ๋ฌธ์ž์—ด view๊ฐ€ ๋œ ๊ฐ’์„ UTF-8 ์žฌ์ธ์ฝ”๋”ฉํ•˜๋Š” ๋‹จ์ˆœ bytes ๋น„๊ต;
  • tests/test_saas_web.py: raw b'wrong-\xff-key'๊ฐ€ 401์ด์–ด์•ผ ํ•œ๋‹ค๋Š” ํšŒ๊ท€;
  • .jules/sentinel.md: ๋ฌธ์ž์—ด view๋ฅผ ํ•ญ์ƒ UTF-8 bytes๋กœ ๋ฐ”๊พธ๋ผ๋Š” ์ผ๋ฐ˜ํ™”๋œ ์˜ˆ๋ฐฉ ๋ฌธ๊ตฌ.

Canonical #520์€ request.scope['headers']์˜ raw ASGI bytes๋ฅผ ์ง์ ‘ ์ธ์ฆ authority๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์ •ํ™•ํžˆ ํ•˜๋‚˜์˜ X-API-Key๋งŒ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ malformed/non-ASCII raw bytes๋Š” ์˜ˆ์™ธ ์—†์ด 401๋กœ ๊ฑฐ์ ˆํ•˜๋ฉด์„œ, configured Unicode credential์˜ ์ง„์งœ UTF-8 bytes๋Š” Starlette/Latin-1 ๋ฌธ์ž์—ด round-trip ์—†์ด ์ •์ƒ ์ธ์ฆ๋ฉ๋‹ˆ๋‹ค. #520์€ ์ด Unicode success path, ๋‹ค๋ฅธ Unicode credential rejection, duplicate-header fail-closed, ๊ธฐ์กด non-ASCII rejection์„ ๋ชจ๋‘ executable regression์œผ๋กœ ๋ณด์œ ํ•ฉ๋‹ˆ๋‹ค.

#523์˜ ๋‹จ์ˆœ request.headers.get(...).encode('utf-8') ๊ตฌํ˜„์€ Unicode configured key์˜ public contract๋ฅผ ์ถ•์†Œํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ successor์— ์Šน๊ณ„ํ•  ์œ ํšจํ•œ ๋ณ„๋„ source delta๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. .jules์˜ blanket ์˜ˆ๋ฐฉ ๊ทœ์น™๋„ ๊ฐ™์€ ์ด์œ ๋กœ canonical source๋ณด๋‹ค ์•ฝํ•˜๊ณ  ๋ถ€์ •ํ™•ํ•ด ๋ณ„๋„ ์Šน๊ณ„ ๋Œ€์ƒ์ด ์•„๋‹™๋‹ˆ๋‹ค.

#520์€ protected main@90717c6e9954bf3b7a351137995ebe89975e46c2๋ฅผ non-force two-parent descendant๋กœ ์ด๋ฏธ ์ฑ„ํƒํ–ˆ๊ณ  fresh compare๊ฐ€ behind_by=0์ธ exact head 9ee46273...์ž…๋‹ˆ๋‹ค. ํ•ด๋‹น head์˜ hosted CI/security evidence๋Š” ์ƒˆ๋กœ queued/pending์ด๋ฉฐ predecessor evidence๋Š” ์ด์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ ์ด PR์€ ๋‹จ์ˆœ queue ์ •๋ฆฌ๊ฐ€ ์•„๋‹ˆ๋ผ ๋ชจ๋“  ์œ ํšจ behavior/test contract๊ฐ€ stronger canonical successor #520์— ์™„์ „ ์Šน๊ณ„๋˜๊ณ , ์•ฝํ•œ/ํšŒ๊ท€ ๊ฐ€๋Šฅํ•œ ๊ตฌํ˜„๊ณผ ๊ณผ๋„ํ•œ ์ผ๋ฐ˜ํ™” ๋ฌธ๊ตฌ๋Š” ์˜๋„์ ์œผ๋กœ ์Šน๊ณ„ํ•˜์ง€ ์•Š๋Š” verified-succession close ๋Œ€์ƒ์ž…๋‹ˆ๋‹ค.

๋น„-ASCII ๋ฌธ์ž์—ด์„ `hmac.compare_digest`์— ์ „๋‹ฌํ•˜๋ฉด `TypeError`๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ
์„œ๋น„์Šค ๊ฑฐ๋ถ€(DoS)๋ฅผ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ๋Š” ์ทจ์•ฝ์ ์„ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
๋ฌธ์ž์—ด์„ ๋น„๊ตํ•˜๊ธฐ ์ „์— UTF-8 ๋ฐ”์ดํŠธ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ž…๋ ฅ ๋ฌธ์ž์— ๊ด€๊ณ„์—†์ด
์•ˆ์ „ํ•˜๊ฒŒ ์ฒ˜๋ฆฌ๋˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์œผ๋ฉฐ, ๋ฃจํ”„ ์™ธ๋ถ€์—์„œ ์ œ๊ณต๋œ ํ‚ค๋ฅผ ๋ฏธ๋ฆฌ ์ธ์ฝ”๋”ฉํ•˜์—ฌ
๋น„๊ต ์„ฑ๋Šฅ๋„ ์ตœ์ ํ™”ํ–ˆ์Šต๋‹ˆ๋‹ค.
@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 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: Youโ€™ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 60074b87-7c9a-4dad-aba0-a4a53101a5aa

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 90717c6 and cc08a82.

๐Ÿ“’ Files selected for processing (3)
  • .jules/sentinel.md
  • saas_web.py
  • tests/test_saas_web.py

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 closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant