fix(auth): enforce permission scope on config writes - #456
Conversation
Require unrestricted scope for singleton configuration and matching account/provider scope for ladder writes. Preserve key-owner constraints and apply strict matching to constrained admin grants on these paths. Verify actual HTTP authorization and PostgreSQL mutation boundaries. Refs #404 (config portion; marketplace and revoke remain).
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (9)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughConfiguration updates now apply strict-scope permission checks and account-scope rules. The permission matcher evaluates constrained grants more narrowly. Integration tests exercise the updated handlers with varied permissions and account scopes. ChangesConfiguration permission constraints
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Requester
participant updateConfig
participant requirePermission
participant requireGlobalConfigScope
Requester->>updateConfig: Send configuration update
updateConfig->>requirePermission: Check update:config
requirePermission-->>updateConfig: Return authorized session
updateConfig->>requireGlobalConfigScope: Check session scope
requireGlobalConfigScope->>requirePermission: Check strict-scope update:config
requirePermission-->>requireGlobalConfigScope: Return permission result
requireGlobalConfigScope-->>updateConfig: Return scope result
updateConfig->>updateConfig: Proceed with update when checks pass
Merge Risk: ⚪ Minimal · up to The configuration writes enforce the intended scope restrictions while preserving key-owner permission intersection. No concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
Final gate: independent review and fresh HTTP/auth/PostgreSQL race verification cover d1f27a6; all hosted checks passed, and the automatic review reports no actionable findings. The docstring-percentage warning does not justify adding comments that restate these private helpers; the request-only StrictScope behavior is documented in code, consistent with the project guidance to comment sparingly. This resolves only the config slice. Issue #404 remains open for marketplace and revoke enforcement. |
Config writes checked permission verbs but could ignore the granting permission's account, provider, service, or region constraints. This rejects out-of-scope writes before persistence: ladder configuration requires matching account/provider scope, while global and RI-exchange configuration require unrestricted scope.
The request-only strict matcher also bounds constrained admin grants on these paths. Existing account-access checks, key-owner permission intersection, region normalization, and RI-exchange auto-mode authorization remain in force.
Validation:
d1f27a6de6ee71d1d9836a756ed7b1511ffaf662with no actionable findings. Fresh reviewer PostgreSQL databases passed the production HTTP/auth matrix in 3.823s and the infrastructure-key HTTP/router fixture in 3.683s, both with the race detector. The reviewer used the same disclosed local database bootstrap substitution; no cloud SDK or secret-loading claim is made.Refs #404. This is part 1 of 3. Marketplace and revoke enforcement remain tracked by #404, which must stay open until both dependent parts land.
Summary by CodeRabbit