Skip to content

security(auth): reject unsupported JWT crit headers - #789

Open
seonghobae wants to merge 12 commits into
mainfrom
sentinel/jwt-crit-validation-16570658157523858824
Open

security(auth): reject unsupported JWT crit headers#789
seonghobae wants to merge 12 commits into
mainfrom
sentinel/jwt-crit-validation-16570658157523858824

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Security outcome

Reject every JWT whose JOSE header declares crit, because this verifier implements no critical JWS extensions. The validation occurs before JWKS lookup or signature verification.

Fail-closed boundary

  • reject a present crit: null instead of confusing absence with a null value
  • reject non-list, empty, non-string-member, and more-than-10-member forms as malformed
  • reject well-formed lists of 1–10 strings as unsupported critical extensions
  • preserve headers with no crit member and the existing configured asymmetric algorithm allowlist
  • impose the list-size bound before iterating attacker-controlled members

Test-first evidence

  • PyJWT contract repair: CI first failed on raw JWK/options types; the verifier now converts the selected JWK to a typed PyJWK, supplies typed claim requirements, and passes leeway through PyJWT's dedicated argument. Existing claim and revocation tests were re-isolated at the JWK boundary.
  • RED: the new boundary suite produced 7 expected failures against protected-main behavior
  • GREEN: focused critical-header and auth-security suites passed (38 passed)
  • exact-head CI, Security Scan, and SAST Semgrep: passed
  • mypy for app/auth.py: passed

Exact head: b40f5efc9b0f4ce219d4236f50fb56ee3033482c. Automated review and independent approval remain required. This branch also contains the PyJWT dependency migration and lockfile updates already present on its predecessor head; it contains no database migration or workflow change.

…파라미터가 명시적으로 검증되지 않고 있었습니다. RFC 7515에 따라 애플리케이션이 지원하지 않는 crit 파라미터가 포함된 토큰은 거부되어야 합니다. crit 헤더 검증 로직을 추가하고 테스트를 보완했습니다.
@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 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ffdf8824-1214-4b18-8a3c-93c07df6f365

📥 Commits

Reviewing files that changed from the base of the PR and between 72afe6d and b40f5ef.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • .jules/sentinel.md
  • backend/app/auth.py
  • backend/pyproject.toml
  • backend/tests/test_auth_crit_rfc7515.py
  • backend/tests/test_auth_security.py
  • frontend/package.json

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 and others added 2 commits August 8, 2026 08:41
…파라미터가 명시적으로 검증되지 않고 있었습니다. RFC 7515에 따라 애플리케이션이 지원하지 않는 crit 파라미터가 포함된 토큰은 거부되어야 합니다. crit 헤더 검증 로직을 추가하고 테스트를 보완했습니다.
@seonghobae seonghobae changed the title 🛡️ Sentinel: [HIGH] JWT crit 헤더 검증 로직 구현 security(auth): reject unsupported JWT crit headers Aug 9, 2026
seonghobae and others added 7 commits August 9, 2026 23:45
…증 로직 추가: 빈 리스트를 포함한 모든 `crit` 헤더를 거부(HTTP 401)하도록 하여 알 수 없는 확장을 통한 우회를 방지했습니다.\n2. JWT JWKS Refresh 취약점 픽스 (CVE-2025-XXXX): `_get_jwks` 함수의 중복된 캐시 검사 로직을 제거하여 `force_refresh=True`인 경우 무조건 새로운 JWKS를 가져오도록 수정했습니다. 이는 타이밍 윈도우를 악용한 공격이나 만료된 토큰이 검증을 통과하는 문제를 방지합니다.
… 새로운 요청을 보내도록 `auth.py` 로직을 수정한 것에 맞춰, 캐시를 우회하고 실제로 네트워크 요청을 하는지 검증하도록 테스트 코드의 assertion을 변경했습니다.
…점이 보고된(CVE-2024-23342, PYSEC-2026-1325) ecdsa 버전을 의존성으로 고정하고 있는 unmaintained 라이브러리인 python-jose를, 보안 업데이트가 원활하게 지원되는 PyJWT[crypto]로 교체했습니다. \n또한 프론트엔드의 취약한 nanoid 패키지(CVE-2026-67213, GHSA-2v37-7h3g-55p8)도 3.3.18 버전으로 함께 업데이트했습니다.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please review exact head b40f5efc9b0f4ce219d4236f50fb56ee3033482c; CI, Security Scan, and SAST Semgrep have passed on this head.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

@seonghobae I will review pull request #789 at exact head b40f5efc9b0f4ce219d4236f50fb56ee3033482c.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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