fix(auth): reject non-ASCII API keys without a 500 - #555
Draft
seonghobae wants to merge 1 commit into
Draft
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
require_api_key가 user-controlledX-API-Key를 Pythonstr그대로hmac.compare_digest()에 넘기면 non-ASCII 값에서TypeError가 발생할 수 있어 인증 실패가 401이 아니라 application 500으로 번질 수 있습니다.변경
hmac.compare_digest()를 사용합니다.범위 정리
이 successor는 predecessor #553의 유효 auth semantic delta와 regression test만 승계합니다. #553 후속 commit의
httpx2/httpcore2dependency 제거는 인증 결함과 인과관계가 없고 별도 canonical dependency-security lane(#550)과 충돌하므로 포함하지 않습니다. source-neutral rebuild commit과 과도한[MEDIUM] DoSframing도 승계하지 않습니다. 원격 DoS 영향도는 별도 load evidence 없이 주장하지 않습니다.검증
main@47c6fd27de13b0da37a7db64697b8699419093517f85b60fd0b8c1f2247766d89ea06754df970185saas_web.py,tests/test_saas_web.py두 개뿐입니다.Rollback
인증 비교를 기존 str 경계로 되돌리면 non-ASCII header 예외가 재발할 수 있으므로, 회귀가 있을 경우 bytes normalization 방식을 대체 구현으로 고치되 401 regression은 유지합니다.