Skip to content

๐Ÿ›ก๏ธ Sentinel: [HIGH] API ํ‚ค ๊ฒ€์ฆ ์‹œ ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์€ ์˜ˆ์™ธ๋กœ ์ธํ•œ DoS ์ทจ์•ฝ์  ์ˆ˜์ • - #508

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

๐Ÿ›ก๏ธ Sentinel: [HIGH] API ํ‚ค ๊ฒ€์ฆ ์‹œ ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์€ ์˜ˆ์™ธ๋กœ ์ธํ•œ DoS ์ทจ์•ฝ์  ์ˆ˜์ •#508
seonghobae wants to merge 1 commit into
mainfrom
sentinel-hmac-dos-fix-14275365354855571317

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Verified succession

Exact predecessor 590ece8c8ccdc010141734e153fe14c0f1b8aca4๋Š” decoded X-API-Key ๋ฌธ์ž์—ด์„ UTF-8 bytes๋กœ ์žฌ์ธ์ฝ”๋”ฉํ•˜๊ณ , raw UTF-8 wrong-key-รถ mismatch๊ฐ€ 401์ธ์ง€ ํ™•์ธํ•˜๋Š” async regression๊ณผ ๋™์ผ ๋ฐฉ์‹์˜ .jules ์ง€์นจ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. Canonical #520 exact cf730d007543ee828b7b8e77c9473288924047d4๊ฐ€ raw ASGI bytes์—์„œ non-ASCII mismatchโ†’401์„ ๋ณด์กดํ•˜๋ฉฐ configured Unicode success์™€ duplicate-header fail-closed๊นŒ์ง€ ๋” ๊ฐ•ํ•˜๊ฒŒ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

์œ ํšจ behavior/test contract๋Š” #520์— ์™„์ „ ์Šน๊ณ„๋์Šต๋‹ˆ๋‹ค. decoded string ์žฌ์ธ์ฝ”๋”ฉ๊ณผ blanket encoding ์ง€์นจ์€ Unicode credential byte identity๋ฅผ ํ›ผ์†ํ•  ์ˆ˜ ์žˆ์–ด ๋ณ„๋„ ์œ ํšจ delta๊ฐ€ ์•„๋‹ˆ๋ฉฐ canonical .jules guidance๋Š” raw-ASGI boundary๋กœ ๊ต์ •๋์Šต๋‹ˆ๋‹ค. #520์€ protected main@90717c6e9954bf3b7a351137995ebe89975e46c2 ๋Œ€๋น„ behind_by=0์ธ non-force descendant์ž…๋‹ˆ๋‹ค.

@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 Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 31 minutes.

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: Pro Plus

Run ID: 00958c37-f5b0-4471-ba16-fbad241a4156

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between a8e4956 and 590ece8.

๐Ÿ“’ 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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

Comment thread saas_web.py
configured_keys = get_configured_api_keys()
if configured_keys and not (request.method == "GET" and request.url.path == "/"):
provided_key = request.headers.get("x-api-key", "")
provided_key = request.headers.get("x-api-key", "").encode("utf-8")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐ŸŸก Non-Latin-1 API keys always fail

For keys containing characters outside Latin-1, provided_key.encode("utf-8") changes the header bytes. Every valid request receives 401.

Suggested change
provided_key = request.headers.get("x-api-key", "").encode("utf-8")
provided_key = request.headers.get("x-api-key", "").encode("latin-1")
Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

Comment thread tests/test_saas_web.py
Comment on lines +51 to +52
with patch.dict(os.environ, {"CODEC_CARVER_API_KEYS": "secret-key"}):
response = await saas_web.require_api_key(request, mock_call_next)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ” Runtime secret source remains noncompliant

The test reinforces runtime use of CODEC_CARVER_API_KEYS. AGENTS.md requires this authentication path to migrate to a credential registry.

Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

Comment thread tests/test_saas_web.py
Comment on lines +39 to +56
# Setup a mock request with a non-ASCII API key header
scope = {
"type": "http",
"method": "POST",
"path": "/shrink",
"headers": [(b"x-api-key", "wrong-key-รถ".encode("utf-8"))],
}
request = Request(scope)

async def mock_call_next(request):
return "SUCCESS"

with patch.dict(os.environ, {"CODEC_CARVER_API_KEYS": "secret-key"}):
response = await saas_web.require_api_key(request, mock_call_next)

self.assertEqual(response.status_code, 401)
body = json.loads(response.body.decode('utf-8'))
self.assertEqual(body["error"], "Invalid or missing API key")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ” Test bypasses HTTP decoding

The direct require_api_key call only proves malformed input returns 401. It never tests a valid non-ASCII key through the HTTP client.

Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

@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