feat(agent): enforce authorization at tool execution boundary #169
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.79) × (1 − Review Confidence (0.65)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.79 · 853 lines diff across 10 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.35 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.400
Sensitive Paths
sensitive_paths
0.079
Real PR Conversation Timeline
2 items
Approved
LGTM,thanks for you
yuluo-yx
Koiyd
Describe what this PR does / why we need it
Adds opt-in authorization enforcement at the tool execution boundary, enabling applications to control which principals can invoke which tools based on runtime context.
This PR introduces:
Does this pull request fix one issue?
Fixes #120
Refs agentic-ai-java/argi#117
Describe how you did it
1. Created
AuthorizationDecisionas an immutable value type representing allow/deny outcomes2. Defined
ToolAuthorizationPolicyfunctional interface as the application SPI, with three built-in static factory methods covering common cases3. Implemented
ToolAuthorizationInterceptorextendingToolInterceptor, which readsTrustedExecutionContextfromRunnableConfigand invokes the policy before forwarding to the next handler4. Extended
BackgroundTaskto record the creating principal's tenant5. Added tenant-scoped
getTask(id, callerTenantId)method toTaskRepositoryinterface as a default method; null caller has unrestricted access6. Implemented tenant-isolated lookup in
DefaultTaskRepositoryand updatedTaskOutputToolto pass caller's tenantId from trusted execution contextDescribe how to verify it
Run the test suite:
All 18 tests pass, covering:
Special notes for reviews
Opt-in design: No ToolAuthorizationInterceptor is registered by default. Existing AgentToolNode configurations are unaffected and execute tools without authorization checks. Applications must explicitly add the interceptor to enable authorization.
Built-in policies reduce friction: The three factory methods (allowAll, denyAll, requireMatchingTenant) provide reasonable starting points without requiring a full custom policy implementation.
Execution order matters: ToolAuthorizationInterceptor should typically be placed early in the interceptor chain (before retry/fallback) so that revoked access takes effect immediately, including on retries.