feat(auth): add privacy-safe project role reads#178
Conversation
📝 WalkthroughWalkthroughAUTH-10B2 adds three project authorization read endpoints for contributor candidates and role grants. It introduces signed keyset pagination, human-only rate-gated authorization, filtered repository reads, strict response schemas, startup secret validation, API contract tests, and rollout documentation. ChangesProject authorization read rollout
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant authorization_router
participant enforce_human_authorization_read
participant ProjectRoleReadService
participant AdminAuthorizationRepository
Client->>authorization_router: Request project read
authorization_router->>enforce_human_authorization_read: Apply rate and human-subject gates
authorization_router->>ProjectRoleReadService: Resolve authorized read
ProjectRoleReadService->>AdminAuthorizationRepository: Query candidates or grants
AdminAuthorizationRepository-->>ProjectRoleReadService: Return paginated rows
ProjectRoleReadService-->>Client: Return typed response or concealed error
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
…to codex/ws-auth-001-10b2-project-role-grant-reads
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/chunks/WS-AUTH-001-10B2-project-role-grant-reads.md (1)
221-226: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy liftSplit the 503 ordering rule. Keep lines 221-226 limited to the pre-admission/rate-gate
429/503path. The evidence-persistence503in 238-243 is a separate post-decision failure mode and shouldn’t be folded into the same “before the identical nonhuman 404” guarantee; define separate ordering or narrow the wording.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/chunks/WS-AUTH-001-10B2-project-role-grant-reads.md around lines 221 - 226, The dependency-precedence statement around “verified token” and “exhausted 429 or private retryable 503” must cover only pre-admission/rate-gate failures. Narrow that wording so the evidence-persistence 503 described later is explicitly treated as a separate post-decision failure mode, without applying the “before the identical nonhuman 404” ordering guarantee to it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
@.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/chunks/WS-AUTH-001-10B2-project-role-grant-reads.md:
- Around line 221-226: The dependency-precedence statement around “verified
token” and “exhausted 429 or private retryable 503” must cover only
pre-admission/rate-gate failures. Narrow that wording so the
evidence-persistence 503 described later is explicitly treated as a separate
post-decision failure mode, without applying the “before the identical nonhuman
404” ordering guarantee to it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ac2a18bc-c229-4673-a2d1-e88a878888c0
📒 Files selected for processing (7)
.agent-loop/REVIEW_LOG.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/chunks/WS-AUTH-001-10B2-project-role-grant-reads.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-10B2-external-review-response.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-10B2-internal-review-evidence.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-10B2-pr-trust-bundle.mdbackend/scripts/api_contract_e2e.pybackend/tests/test_audit.py
🚧 Files skipped from review as they are similar to previous changes (3)
- .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-10B2-internal-review-evidence.md
- .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-10B2-pr-trust-bundle.md
- backend/scripts/api_contract_e2e.py
…ole-grant-reads' into codex/ws-auth-001-10b2-project-role-grant-reads
…to codex/ws-auth-001-10b2-project-role-grant-reads # Conflicts: # backend/tests/conftest.py # backend/tests/test_authorization.py
…2-project-role-grant-reads # Conflicts: # backend/tests/test_api_controls.py
Workstream PR Trust Bundle
Chunk
WS-AUTH-001-10B2- Privacy-Safe Project Role Grant ReadsMerge intent:
.agent-loop/merge-intents/WS-AUTH-001-10B2.jsonGoal
Expose privacy-safe contributor-candidate and immutable project-role-grant reads through exactly three authenticated, rate-controlled project actions.
Human-Approved Intent
.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/INTENT.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/chunks/WS-AUTH-001-10B2-project-role-grant-reads.mdThe user explicitly started this signed successor after 10B1 merged. Signed loop memory binds it to trusted main
14fa4316.What Changed
Why It Changed
Project managers and auditors need bounded authorization reads without disclosing identity-link facts, private identity data, row existence, or grant history outside their scope.
Design Chosen
Authorization runs before cursor or private-row lookup. One durable rate consumption precedes nonhuman concealment. Candidate lifecycle remains a kernel guard; grant history remains readable in every project state. HMAC-SHA256 keyset cursors bind action, project, filters, limit, ordering, timestamp, and UUID.
Alternatives Rejected
Scope Control
Allowed Files Changed
Files Outside Contract
No migration, workflow, dependency, PREP, mutation, frontend, or AUTH-10C implementation is included.
Product Behavior
Evidence
Commands Run
Result Summary
Acceptance Criteria Proof
Test Delta
Tests Added
Tests Modified
Tests Removed Or Skipped
Internal Reviewer Results
Reviewed code SHA:
95c3ecf77afed2746a66f314d05eb547cfa15f3cReviewed at: 2026-07-22T04:55:55Z
Reviewer run IDs:
/root/auth10b1_final_core,/root/auth10b1_final_security_qa,/root/auth10b1_final_ops_docs_ciNo reviewer sessions remain open.
External Review
External review response: no actionable CodeRabbit inline comment exists on the current head; its latest run was rate-limited.
CI And Gate Integrity
Remaining Risks
The authorization and privacy blast radius is L1. Full GitHub shard and aggregate coverage proof is green. CodeRabbit's displayed 37.61% is inconsistent with the unchanged repository CI command, which passes at 87.6%.
Follow-Up Work
AUTH-10C is only a declared same-initiative successor and requires a fresh explicit signed start after this PR merges.
Human Review Focus
Please inspect authorization ordering, Project Manager/Audit scope and lifecycle boundaries, cursor binding, response minimization, identical concealment, and the exact three-action activation.
Human Merge Ownership
Do not merge without the user's explicit approval of PR #178.
Summary by CodeRabbit