Skip to content

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

Open
seonghobae wants to merge 2 commits into
mainfrom
sentinel-fix-hmac-unicode-dos-3875179072510415708
Open

seonghobae wants to merge 2 commits into
mainfrom
sentinel-fix-hmac-unicode-dos-3875179072510415708

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

๐Ÿšจ ์‹ฌ๊ฐ๋„: HIGH
๐Ÿ’ก ์ทจ์•ฝ์ : hmac.compare_digest() ํ•จ์ˆ˜์— ๋น„-ASCII(Non-ASCII) ๋ฌธ์ž๊ฐ€ ํฌํ•จ๋œ ๋ฌธ์ž์—ด์„ ์ „๋‹ฌํ•  ๋•Œ ๋ฐœ์ƒํ•˜๋Š” TypeError๋กœ ์ธํ•œ ์„œ๋น„์Šค ๊ฑฐ๋ถ€(DoS) ์ทจ์•ฝ์  (CWE-400 / CWE-754).
๐ŸŽฏ ์˜ํ–ฅ: ๊ณต๊ฒฉ์ž๊ฐ€ HTTP ํ—ค๋”(์˜ˆ: X-API-Key)์— ์˜๋„์ ์œผ๋กœ ํ•œ๊ธ€ ๋“ฑ ๋น„-ASCII ๋ฌธ์ž๋ฅผ ์ „์†กํ•˜๋ฉด FastAPI ๋ฏธ๋“ค์›จ์–ด์—์„œ TypeError ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์ด๋ฅผ ์ฒ˜๋ฆฌํ•˜์ง€ ๋ชปํ•ด 500 Internal Server Error ์ƒํƒœ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ์ง€์†์ ์ธ ๊ณต๊ฒฉ์€ ์„œ๋ฒ„ ๋ฆฌ์†Œ์Šค๋ฅผ ๋‚ญ๋น„ํ•˜๊ณ  ์ •์ƒ์ ์ธ ์š”์ฒญ ์ฒ˜๋ฆฌ๋ฅผ ๋ฐฉํ•ดํ•˜์—ฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ DoS๋ฅผ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๐Ÿ”ง ํ•ด๊ฒฐ์ฑ…: saas_web.py ๋ฏธ๋“ค์›จ์–ด์—์„œ ์ œ๊ณต๋œ ํ‚ค์™€ ์„ค์ •๋œ ํ‚ค๋ฅผ hmac.compare_digest()๋กœ ๋น„๊ตํ•˜๊ธฐ ์ „์— .encode("latin1") (์ œ๊ณต๋œ ํ‚ค, Starlette ๊ธฐ๋ณธ ๋””์ฝ”๋”ฉ) ๋ฐ .encode("utf-8") (์„ค์ •๋œ ํ‚ค)์„ ์‚ฌ์šฉํ•˜์—ฌ ์•ˆ์ „ํ•˜๊ฒŒ ๋ฐ”์ดํŠธ(bytes)๋กœ ๋ณ€ํ™˜ํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
โœ… ๊ฒ€์ฆ: ํ•œ๊ธ€ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•ด X-API-Key ํ—ค๋”๋ฅผ ์ „์†กํ•  ๋•Œ 500 ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๊ณ  ์˜ฌ๋ฐ”๋ฅธ ์‘๋‹ต ๋˜๋Š” 401 ๊ถŒํ•œ ์—†์Œ ์˜ค๋ฅ˜๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ํ†ต๊ณผ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.


PR created automatically by Jules for task 3875179072510415708 started by @seonghobae

@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 Oct 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 53 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

โš™๏ธ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 08dc954f-0883-4e2d-b6b8-b23dec5e2cc6
๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 47c6fd2 and a4369a5.

๐Ÿ“’ Files selected for processing (3)
  • .jules/sentinel.md
  • saas_web.py
  • tests/test_saas_web.py
  • Autopilot ยท Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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