Skip to content

fix(security): enforce tenant context authority invariant - #356

Open
seonghobae wants to merge 2 commits into
mainfrom
fix/tenant-context-authority-main-20260811
Open

fix(security): enforce tenant context authority invariant#356
seonghobae wants to merge 2 commits into
mainfrom
fix/tenant-context-authority-main-20260811

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

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 to null, allowing malformed contexts to cross service boundaries.

Test-first state

This Draft starts intentionally RED at exact test-only head 62590a3ee102642533b36c47fe467fcedc7252f6. TenantContextAuthorityInvariantTest requires 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

TenantContext constructor 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.

@coderabbitai

coderabbitai Bot commented Aug 10, 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: 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 @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: 73a537f4-2f7f-4efb-a0b5-8efedbce52e3

📥 Commits

Reviewing files that changed from the base of the PR and between 55d7ae8 and f831d0f.

📒 Files selected for processing (2)
  • src/main/java/com/clearfolio/viewer/auth/TenantContext.java
  • src/test/java/com/clearfolio/viewer/auth/TenantContextAuthorityInvariantTest.java

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
seonghobae marked this pull request as ready for review August 10, 2026 20:19
@seonghobae
seonghobae enabled auto-merge (squash) August 10, 2026 20:32
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