AWS Builder Center

After login: per-operation authorization, revocation and recovery for agent tools

An architecture exercise on tool authorization, revocation windows and interrupted remediation. Includes a local Node.js 22.13+ lab using built-in SQLite, without additional runtime dependencies or an AWS account.

Senior Solutions Architect at Banco Itaú | Cloud, event-driven, AI agents & FinOps

A valid login is only the starting point

An agent may continue a conversation after a user loses a permission. The operational question is whether the next tool call can still change a resource. This article proposes an architecture exercise, not a report of an AWS deployment or a completed cloud experiment. The AWS scenarios below are test proposals; the local recovery lab has a narrower purpose.
The starting points are Carlos Biagolini's articles on AgentCore Identity  and a serverless MCP server with IAM authentication . They motivate a useful follow-up: once identity is established, which component enforces the right to perform each operation, and what happens if execution is interrupted?

Separate three decisions

Authentication establishes the caller's identity. Authorization decides whether that caller may perform a particular operation on a particular resource and tenant. Approval records consent to a concrete proposed change. A valid token, a visible tool or an old approval does not answer all three questions.
Imagine a remediation tool shared by two tenants. A caller may have permission to invoke the endpoint and still lack permission to change the selected resource. Similarly, approval of an earlier proposal should not authorize a modified proposal. These checks must remain explicit even when the model produces a convincing explanation.

A route is a boundary, not the whole policy

API Gateway HTTP APIs  support IAM, JWT authorizers and Lambda authorizers. This exercise compares IAM-based invocation with application-defined Lambda authorization. With AWS_IAM, a signed request and invocation permission control entry. A Lambda authorizer applies application logic: format 1.0 requires an IAM policy; format 2.0 also supports a simple Boolean response when enabled.
If several MCP tools share POST /mcp, the tool name and arguments live in the body. Permission to invoke that route does not establish permission for every operation carried by it. In this design, the executor enforces fine-grained authorization. Another trusted layer could do so if it understands the operation, cannot be bypassed and must run before the effect. Separate routes help entry controls but do not remove resource and tenant checks.
Do not accept a model-supplied tenant as proof of authority. In a JWT flow, use validated claims and their authorized relationship to the resource. In an IAM/SigV4 flow, use the authenticated principal and a service-controlled authorization mapping. Carry that trusted context to the execution boundary. A Lambda role's ability to access DynamoDB does not automatically prove that every caller may read every item the function can access.
1
2
3
4
5
6
7
8
flowchart TD
A[Authenticated caller] --> B[Route entry control]
B --> C[Validate tool contract]
C --> D{Operation and resource allowed for tenant?}
D -->|No| X[Deny before protected access]
D -->|Yes| E[Bind approval to identity, digest, scope and expiry]
E --> F[Constrained executor]
F --> G[Durable outcome evidence]

Revocation has an observable window

IAM documentation  explains that temporary-credential permissions are evaluated for AWS requests, while policy updates may take minutes to propagate. Per-request evaluation therefore does not imply instantaneous revocation.
A cached Lambda-authorizer result  introduces another window. Include the cache key, route separation and TTL in the test design. Denying future work does not reverse a completed effect. Sensitive operations also need an explicit policy for in-flight work and a check near the effect boundary.

Approval and completion are different facts

Bind approval to reviewer identity, proposal digest, scope, expiry and expected resource state. After a worker restart, a pending record does not prove whether an effect happened. Look for durable target evidence before replaying. If evidence is insufficient, preserve uncertainty and request review instead of guessing.
The public v0.4.0 lab  explores that recovery boundary with SQLite and a synthetic target. Its reproduction guide  requires Node.js 22.13+ and creates local files. No AWS account is needed. CLI approval is simulated; the lab does not implement authenticated approval, IAM or revocation. Atomic local target-and-receipt writes do not establish exactly-once effects across a remote API.
In the documented exercise, a deliberate crash occurs after the synthetic target and receipt are committed but before the execution ledger acknowledges completion. Recovery uses that receipt to reconcile the operation. Keeping the original proposal matters: generating a new proposal after the target changes produces a different digest. This is a concrete way to discuss recovery without implying a cloud guarantee the exercise cannot demonstrate.

Proposed test matrix

ScenarioExpected behaviorEvidence to retain
Valid principal requests another tenantDeny before protected data accessSynthetic identity and decision
Shared MCP endpoint receives an unauthorized toolDeny at the operation boundaryTool name, scope and decision
Permission changes during a sessionMeasure when new calls stop succeedingChange time and decision timeline
Authorizer result is cachedTest before and after TTL across routes and tenantsCache settings and observations
Proposal changes after approvalReject the changed digestOriginal and changed synthetic digests
Resource changes before executionReject the stale preconditionExpected and observed version
Process stops after effect, before acknowledgementReconcile using evidenceLedger, target version and receipt
For every scenario, distinguish expected from observed results. These AWS authorization tests are proposed, not completed. Use synthetic inputs and avoid storing tokens, secrets or customer data.

Trade-offs and the next experiment

Fresh authorization checks add work and latency. Caching can reduce both while extending the stale-decision window. Choose the design using operation impact, revocation policy and measurements. A low-risk read and a destructive remediation may justify different controls.
Before adding another agent, ask the team to demonstrate which identity drives the decision, which component enforces it and how interrupted work is recovered. A future isolated experiment can add authenticated approval and revocation, with a cost ceiling and cleanup procedure defined before deployment.
What would you test first: cross-tenant access, revocation during a session, or recovery after the effect? A useful answer includes the evidence needed to prove the outcome.

References


Originally published on fernando.moretes.com , with a Portuguese version, C4 architecture view, Well-Architected analysis and implementation checklist.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article