refactor(authz): require explicit authorization context at dispatch - #380
refactor(authz): require explicit authorization context at dispatch#380florishafkenscheid wants to merge 9 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
🚧 Files skipped from review as they are similar to previous changes (9)
📝 WalkthroughWalkthroughAuthorization now models caller provenance, stable command and query operation names, resource identifiers, and validated checker configuration. Application services, dispatch handles, handlers, domain types, and internal workflows use the new authorization contracts. ChangesAuthorization and dispatch
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant HTTPHandler
participant SharedHandler
participant ApplicationService
participant AuthorizationChecker
participant DomainHandler
HTTPHandler->>SharedHandler: forward Caller, resource ID, and operation-enabled command or query
SharedHandler->>ApplicationService: submit authorization request
ApplicationService->>AuthorizationChecker: validate caller, resource ID, and operation
AuthorizationChecker-->>ApplicationService: authorization result
ApplicationService->>DomainHandler: execute authorized command or query
DomainHandler-->>ApplicationService: return result
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@agent_api_http/src/v0/library/catalog/mod.rs`:
- Around line 145-147: Update the catalog existence precondition in
add_templates_to_catalog and remove_templates_from_catalog to use the
actor-based query_handler path with the current actor, matching catalog reads
and duplicate_template. Replace the internal_query_handler call while preserving
the existing CatalogNotFound conversion and subsequent command authorization
flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4cef3d13-e8d2-44df-bc9d-a195a4d95144
📒 Files selected for processing (10)
agent_api_http/src/handlers.rsagent_api_http/src/v0/holder/holder/credentials/mod.rsagent_api_http/src/v0/holder/holder/offers/accept.rsagent_api_http/src/v0/holder/holder/presentations/mod.rsagent_api_http/src/v0/identity/connections/mod.rsagent_api_http/src/v0/identity/services/linked_vp.rsagent_api_http/src/v0/issuance/credentials.rsagent_api_http/src/v0/library/catalog/mod.rsagent_api_http/src/v0/templates/mod.rsagent_api_http/src/v0/verification/authorization_requests.rs
Description of change
This refactors the shared application authorization contract to make caller provenance, operation identity, resource identity, and checker configuration explicit.
The change:
Option<Actor>withCaller::{Anonymous, Actor, Internal};This keeps the shared kernel neutral while giving downstream applications enough context for granular authorization decisions, including resource- and relationship-based checks. It also prevents missing authorization wiring from being discovered only after requests reach a running service.
How the change has been tested
The shared-kernel tests cover:
All affected workspace call sites were updated for the explicit caller and authorization-checker contracts.
Verify the changes with:
Definition of Done checklist
Summary by CodeRabbit
New Features
Breaking Changes