-
Notifications
You must be signed in to change notification settings - Fork 0
🛡️ Sentinel: [CRITICAL] API 키 인증에서 서비스 거부(DoS) 취약점 수정 #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,8 +113,9 @@ async def require_api_key(request: Request, call_next): | |
| 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_bytes = provided_key.encode("utf-8") | ||
| if not any( | ||
| hmac.compare_digest(provided_key, key) for key in configured_keys | ||
| hmac.compare_digest(provided_key_bytes, key.encode("utf-8")) for key in configured_keys | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: API keys still read from os.environ
Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| ): | ||
| return JSONResponse( | ||
| status_code=401, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: Configured keys re-encoded per request
key.encode("utf-8")at saas_web.py runs inside the generator, re-encoding every configured key on each request. The sentinel note added in this PR (sentinel.md) advises pre-encoding outside the loop. Impact is negligible, but the two disagree.Was this helpful? React with 👍 or 👎 to provide feedback.