fix(security): enforce tenant context authority invariant - #356
fix(security): enforce tenant context authority invariant#356seonghobae wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 55 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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
Objective
Make the internal tenant-authority value object fail closed when callers directly construct it without a tenant or subject identity.
TenantContext.fromHeaders(...)already rejects absent claims, but the public canonical constructor currently normalizes null or blank-after-NUL-removal authority tonull, allowing malformed contexts to cross service boundaries.Test-first state
This Draft starts intentionally RED at exact test-only head
62590a3ee102642533b36c47fe467fcedc7252f6.TenantContextAuthorityInvariantTestrequires direct construction to reject null and blank/control-only tenant or subject identities with stable controlled errors. Protected main accepts those values and therefore fails this regression.Scope
TenantContextconstructor invariant plus focused tests only. This is path-disjoint from active submission-boundary PR #346 and provider-neutral verifier PR #343; it does not alter signed-header verification, OIDC/JWT federation, permissions semantics, controllers, persistence, viewer assets, or demo-only convenience entrypoints.Acceptance
Observe exact-head RED -> narrow constructor invariant -> exact-head
mvn -B --no-transfer-progress verify, 100% owned production coverage/public Javadocs -> CI/Security Scan/SAST/fuzz -> current reviews/threads/live-base refetch. Keep Draft until GREEN exact-head evidence exists. Independent write-authorized approval remains a separate protected-merge gate.