Request Integrity
How AgentShield ensures the request that was signed, authorized, approved, and executed is the same request at every step.
Integrity in AgentShield means that the bytes an agent signed are the bytes the gateway evaluated, the request a human approved is the request that runs, and the arguments policy saw are the arguments the adapter receives. Four hashes enforce this.
The four bindings
| Binding | Hash | Checked when |
|---|---|---|
| Signature → body | SHA-256 of the raw authorize or execute body, inside the signing input | Every request |
| Decision → arguments | SHA-256 of the canonical JSON of arguments | Execute, for adapters that use arguments |
| Approval → request | SHA-256 of the raw authorize body | Execute with an approval_id |
| Evidence → object | SHA-256 of the stored bundle | Every evidence read |
Body signatures
The signing input is <timestamp>.<nonce>.<hex sha256(body)>. The gateway hashes the body exactly as received and never re-serializes it before verification. Any change to any byte, including whitespace, invalidates the signature.
This is why intermediaries must not rewrite request bodies. A proxy that reformats JSON breaks every signature; that is the intended behavior.
Strict parsing
Before hashing arguments or evaluating policy, the gateway parses JSON strictly:
- Duplicate keys are rejected. Different parsers disagree about which duplicate wins, a classic source of signature and policy confusion.
- Unknown fields are rejected in authorize and execute bodies.
- Field formats are checked: UUIDs, tool name pattern, resource length and no NUL bytes, printable idempotency keys, RFC 3339
requested_at. - Body size is capped at 1 MiB, which matches the parser used for redaction and hashing.
Canonical arguments
The gateway computes the canonical form of arguments (sorted keys, no insignificant whitespace, Go encoding/json string escaping) and stores its SHA-256 on the invocation. At execute:
- The agent presents
argumentsagain. - The gateway canonicalizes and hashes them.
- A mismatch returns
409 conflictand nothing is claimed.
Raw arguments are never stored, so the gateway cannot "remember" them for the agent. This is deliberate: arguments often contain secrets, and the schema stores only a redacted copy.
The SDKs restrict argument values to objects, arrays, strings, integers, booleans, and null. Excluding floating-point numbers avoids cross-language differences in number formatting.
Approval binding
A pending approval records the SHA-256 of the raw authorize body. The execution row stores the same hash when it is created. At execute, the approval's hash must equal the execution's, and the approval must belong to the same decision and agent. An approval can therefore release exactly one request: the one the approver saw.
Canonical resources
Policy resource rules compare strings exactly. For http.request, the adapter accepts only the canonical form of a URL, lowercase host, no query, fragment, userinfo, or dot segments, and rejects any other spelling with the canonical form in the error. One URL therefore has exactly one representation, and a policy rule for it cannot be bypassed with an alternative encoding.
Audit hashing
Each security event's audit link hashes a canonical header containing the event id, type, timestamp (UTC, nine fractional digits), organization, the SHA-256 of the canonical redacted payload, and the previous link's hash. See Auditability.
Implementation references
Was this page helpful?
Authentication and Authorization
A security analysis of how AgentShield separates identity from authority for agents and humans, and the attacks each design choice closes.
Replay Protection
How nonces, timestamps, idempotency keys, and execution claims together prevent a captured or repeated request from acting twice.