Security
What this SDK guarantees, what it leaves to you, and what it does not do at all. Production Hardening has the knobs; this page is the posture behind them, including the parts that are gaps rather than features.
What holds by construction
| Property | How |
|---|---|
No unsafe code in the published crates' libraries | All four set #![forbid(unsafe_code)], so the library code has no unsafe block to review, and one cannot be added without removing that line in a diff. (Three build scripts, behind the proto and grpc features, call std::env::set_var inside unsafe to point PROTOC at the vendored compiler; they run at build time only.) |
| Panics in library code are a frozen, reviewed list | No .unwrap(), panic!, unreachable!, todo! or unimplemented! in runtime library code, and a short list of .expect( calls (13 at 0.15.0) frozen in scripts/panic_paths_baseline.txt. A CI ratchet (scripts/check_panic_paths.py) fails the build when any count changes, so adding or removing one is a reviewed change |
| Undocumented public API cannot ship | #![deny(missing_docs)] |
| Dependencies are audited | cargo-deny runs in CI over the workspace, and separately over the SLIMRPC binding's much larger tree |
| Releases are attested | SLSA build provenance and a per-crate CycloneDX SBOM are produced by the release workflow |
Authentication
Nothing is authenticated unless you say so. An agent built with no interceptor serves every caller.
| Interceptor | Feature | Use when |
|---|---|---|
BearerTokenAuthInterceptor | none | you validate an opaque token yourself |
ApiKeyAuthInterceptor | none | a shared secret in a header is genuinely enough |
JwtAuthInterceptor | auth-jwt | HS256/RS256/ES256, static or remote JWKS with OIDC discovery |
MutualTlsAuthInterceptor | tls-rustls or grpc-tls | clients hold certificates from a CA you run; the certificate names the caller |
JwtAuthInterceptor is the one to reach for when the caller is another
organisation: it verifies signatures against a key set you did not have to
distribute by hand, and it names the caller from verified claims
(jwt:<issuer>:<sub>). A bearer token or API key names a caller only if you
give it a label (with_labelled_tokens, with_labelled_keys); an unlabelled
one proves only that the caller knew a secret.
Pair it with BearerTokenTenantResolver::with_mapper if you are multi-tenant,
with a closure that verifies the token and returns its tenant claim: default()
verifies nothing, and names the token by a digest as the tenant id. See Multi-Tenancy,
where the failure mode of getting this wrong is spelled out.
Transport
The server terminates TLS on its own listener with tls-rustls:
Server::with_tls_pem takes a certificate chain and key, and Server::with_tls
takes a rustls::ServerConfig as built, so a configuration that requires
client certificates gives mutual TLS on the HTTP bindings as it does on gRPC
(GrpcDispatcher::with_tls, which needs grpc-tls). The WebSocket listener
does the same with WebSocketDispatcher::with_tls and with_tls_pem. The
client certificate reaches the interceptors on every binding, and
MutualTlsAuthInterceptor names the caller from it (Authentication);
until 2026-10-18 the HTTP dispatchers did not see it. See
Production for the setup. A reverse proxy in front remains
a fine choice when it already manages your certificates.
The client and the push sender speak TLS via tls-rustls, which is on by
default in a2a-protocol-sdk, a2a-protocol-client and, since 0.16.0,
a2a-protocol-server.
Outbound requests are the dangerous ones
An agent that accepts a webhook URL from a caller is an SSRF primitive unless
something stops it. The bundled HttpPushSender does:
- private and loopback addresses are rejected at config creation and again at delivery time — defence in depth, because the two moments can disagree;
- IPv4-in-IPv6 smuggling is rejected (
::ffff:mapped, NAT6464:ff9b::, and the deprecated::a.b.c.d); - the non-canonical numeric IPv4 encodings a C resolver still accepts are
normalised and rejected —
http://2852039166/,http://0xA9FEA9FE/andhttp://0251.0376.0251.0376/all denote169.254.169.254; - the validated IP is pinned, so DNS rebinding between check and connect does not help an attacker;
- credentials are checked for
\rand\nbefore they reach a header; - every delivery is capped at 30 seconds;
- with
with_allowed_hosts([...]), only the hosts you name are delivered to; a config naming another host is refused when it is created and a delivery to one is refused before any connection is made (opt-in; the SSRF checks still apply to the hosts allowed); - with
https_only(), anhttp://webhook is refused at config creation and again at delivery, so payloads and credentials never cross the network in plaintext (opt-in: spec §13.2 says webhook URLs SHOULD use HTTPS); - with a
PushConfigCipher(with_cipheron the SQL push-config stores), configs are sealed at rest, bound to their row, so the table holds no token or credential in the clear (opt-in: spec §13.2 says agents SHOULD store them securely).
If you replace the sender, you inherit all of that as your responsibility. The
validation is public in a2a_protocol_server::url_guard: check_public_url
applies the address checks above to a URL, and resolve_public_url also
resolves its host and refuses it if any address is private
(resolve_public_addrs returns every address, for a caller that fails over
from one to the next). Use them rather than reimplementing the list above.
The same applies to file references in messages (spec §14: they "MUST be
validated to prevent SSRF"). The SDK never fetches a Part's URL, so this
falls to an executor that does: call resolve_public_url before fetching and
connect to the address it returns (None means the URL already names an
address, which it has checked), so a second lookup cannot answer differently. To refuse such messages before the
executor runs, call RequestHandlerBuilder::refuse_private_file_urls(); it
checks the URL's form only, without DNS, so an executor that fetches still
has to resolve.
What a card discloses
A card is served to whoever asks, so build() and every card handler refuse a
card, public or extended, that carries a credential in one of its URLs: user
information (user:pass@host) or a query parameter named like a secret
(token, api_key, signature and similar). agent_card::card_credentials
lists the offending fields. A URL naming an internal host (a private address,
.internal, .local) is reported by agent_card::card_warnings, which
build() logs, but not refused (spec §13.3 and §14: the card SHOULD NOT carry
credentials or internal details).
That "the two moments can disagree" is not hypothetical: the numeric-IPv4 line above was added after an adversarial run found the registration check accepting an integer-encoded metadata URL that delivery still blocked. The gap is closed and regression-tested in both the unit suite and the over-the-wire probe.
Data at rest
With the encryption feature, store::encrypted::EncryptedTaskStore wraps
any TaskStore and seals every part of a task (its history, its status
message, its artifacts) and of every event in its log before the wrapped
store sees it. Each part is sealed whole (content, metadata, filename and
media type) and bound to where it is stored: the tenant partition, the task,
the record or the position in the log, the message or artifact id, and its
index there. A part that is altered, moved to any other such place, sealed
under a key the cipher does not hold, or stored unsealed fails the read.
#![allow(unused)] fn main() { use a2a_protocol_sdk::server::store::InMemoryTaskStore; use a2a_protocol_sdk::server::store::encrypted::{Aes256GcmCipher, EncryptedTaskStore}; fn key_from_your_kms(_: &str) -> [u8; 32] { [0; 32] } let ring = Aes256GcmCipher::new("2026-10", key_from_your_kms("2026-10"))? .with_key("2026-09", key_from_your_kms("2026-09"))?; // still opens older values let store = EncryptedTaskStore::new(InMemoryTaskStore::new(), ring.into_arc()); Ok::<(), a2a_protocol_sdk::types::error::A2aError>(()) }
Aes256GcmCipher is AES-256-GCM through ring, with a fresh random 96-bit
nonce per value; one key seals and every key in the ring opens. NIST SP
800-38D §8.3 bounds a key used with random nonces to 2^32 seals, counted
across every process holding the key and every push config sealed with the
ring. A write seals the parts it stores, so an artifact streamed in n
chunks costs n seals on the shipped stores (about n²/2 before
2026-10-18). seal_count() reports this process's count, and a seal past
with_seal_limit (2^32 by default) fails. That count starts at zero in every
process and after every restart, so with R replicas holding one key the
default lets them seal R times the bound between them: set each one's
limit to its share, and rotate the active key well before the total nears
the bound. To keep
keys in a key-management service instead, implement ContentCipher. The
same ring is a PushConfigCipher, so the SQL push-config stores can share
it.
What it does not protect:
- The structure the stores query: task, context, message and artifact
ids, roles, states, timestamps, artifact names and descriptions, message
extensionsandreferenceTaskIds, themetadataof tasks, messages, artifacts and events, and the number and size of parts. Keep personal data out of those fields. - The shape of a record: messages or artifacts reordered or removed, parts removed from the end of one, parts exchanged between two messages with the same id, and a store rolled back to an earlier record all still open.
- The audit trail, which keeps a digest of each event as written: a
reader of the audit store can confirm a guess of a short event's content
unless the audit log protects its records too (
AuditLog::with_privacy; see Audit Trail).
A part that does not open fails the whole read, a list page and a log
replay included, so keep every key that sealed a stored value in the ring
for as long as the value is stored. A store holding data from before the
wrapper was installed is refused until accept_unsealed_parts() is set;
while it is, an unsealed part planted in the store is read as genuine, so
remove it once every record has been rewritten. save and
save_appending_history still seal every part of the task, so they cost
time in proportion to its size.
How this is verified
- Against another implementation.
scripts/crypto_interop/check.py(CI) states the byte layout of every sealed form (the cipher's value, a sealed part, a sealed push config, the audit log's wrapped keys, sealed values and keyed digests) and decrypts what the SDK wrote, checked in ascrates/a2a-protocol-server/tests/fixtures/crypto/rust_sealed.json, with Python'scryptography;crates/a2a-protocol-server/tests/crypto_interop.rsopens what that script sealed with its own nonces through the SDK's ordinary read paths. This shows the formats are standard AES-256-GCM, HKDF-SHA-256 and HMAC-SHA-256 over the stated associated data; it says nothing about nonce uniqueness or key handling. - Against NIST.
crates/a2a-protocol-server/tests/crypto_nist_gcm.rsruns 37 AES-256-GCM cases from NIST CAVP (gcmEncryptExtIV256.rsp,gcmDecrypt256.rsp; 96-bit IV, 128-bit tag, six that must fail) through the cipher's open path and theringcalls its seal makes. - Fuzzing.
sealed_ring_value,sealed_part,sealed_push_configandsealed_audit_value(fuzz/) feed what a store holds to each reader: nothing may panic, nothing unsealed may open, and a sealed value changed in any way must be refused. - Mutation testing of the cipher, sealing and audit-privacy modules (2026-10-21: 210 mutants, none missed once two equivalent spellings were rewritten), alongside the weekly sweep of the whole crate.
Input handling
- The REST dispatcher rejects
..,%2E%2Eand%2e%2ein path segments, and paths that escape the route hierarchy. - Request bodies are capped at 4 MiB (JSON-RPC and REST) and query strings at 4 KiB (REST); SSE events at 16 MiB, configurable.
- A tenant at
max_concurrent_tasksis refused rather than queued, so a declared bound stays a bound under load.
Agent card signing, and the part people miss
signing on a2a-protocol-server makes the signing types available and
enables RequestHandlerBuilder::with_content_signer, which signs the messages
and artifacts the server sends (ADR 0027). The server never signs the card it
serves.
Sign the card yourself with sign_card_es256 and hand the signed card to
RequestHandlerBuilder. An unsigned card is served happily and verifies as
unsigned — the server has done what it was asked, so there is no error to look
for. examples/incident-response does this correctly and is worth copying.
Declare the extensions before you sign. build() advertises the
extensions this server can honour by appending to
capabilities.extensions, and canonicalize_card strips only signatures
— so capabilities.extensions is inside the bytes a signature covers. A
card signed before those entries exist would be served canonicalizing to
bytes nobody signed, and every client that verifies would fail while this
side reported nothing. So build() refuses a signed card it would
otherwise have to edit, and names the URIs to add:
#![allow(unused)] fn main() { use a2a_protocol_types::agent_card::{AgentCard, AgentInterface, AgentSkill}; use a2a_protocol_types::budget::BUDGET_EXTENSION_URI; use a2a_protocol_types::error::A2aResult; use a2a_protocol_types::extensions::AgentExtension; use a2a_protocol_types::failure::FAILURE_EXTENSION_URI; use a2a_protocol_types::idempotency::IDEMPOTENCY_EXTENSION_URI; use a2a_protocol_types::signing::sign_card_es256; fn card_to_serve(pkcs8: &[u8]) -> A2aResult<AgentCard> { let mut card = AgentCard::new( "Triage Agent", "1.0.0", AgentInterface::jsonrpc("https://agent.example/rpc"), ) .with_description("Triages incoming incidents") .with_skill(AgentSkill::new("triage", "Triage", "Triages an incident").with_tags(["triage"])); // Declare first. `AgentExtension::new` leaves `required` unset, which is // what a non-required extension means on the wire. card.capabilities.extensions = Some(vec![ AgentExtension::new(IDEMPOTENCY_EXTENSION_URI), AgentExtension::new(FAILURE_EXTENSION_URI), AgentExtension::new(BUDGET_EXTENSION_URI), ]); // ...then sign the card that results, and hand *that* to the builder. let signature = sign_card_es256(&card, pkcs8, "my-key")?; card.signatures = Some(vec![signature]); Ok(card) } }
Declare only the extensions your configuration actually advertises:
IDEMPOTENCY_EXTENSION_URI is advertised exactly when the configured
TaskStore reports supports_idempotency(), FAILURE_EXTENSION_URI and
BUDGET_EXTENSION_URI always, and the lease and approval URIs when a lease
store or an approval gate is set. Declaring one the server would not have added is allowed — an
operator's own entry is never overwritten — but it advertises a capability
to clients, so declare it only if it holds.
Known gaps
Stated because a security page that lists only strengths is not one.
- No PGP key for vulnerability reports. Email to the maintainer cannot be encrypted end-to-end. Use GitHub Security Advisories instead, which keeps a report private without needing a key.
- Only
v0.15.0and later release tags are signed. Tags sincev0.8.0are annotated, andrelease.ymlrefuses a lightweight tag. Since 2026-10-08 it also refuses a tag not signed by a key in.github/release-signers/, which lists the maintainer's SSH key.v0.15.0(2026-10-25) is the first tag to pass that gate;scripts/verify_tag_signature.sh v0.15.0checks it. Every earlier tag is lightweight or annotated but unsigned, sogit tag -vverifies none of them. For a cryptographic link from a published version to this repository, use the build provenance attestations (gh attestation verify, step 3 ofRELEASING.md), not the tag. - No rate limiting is applied unless you wire it.
rate_limit_rpsis counted in an interceptor; setting the field does nothing unless aRateLimitInterceptoris installed and given the tenant configuration withwith_tenant_config(Multi-Tenancy). Failed credentials are throttled only withAuthFailureThrottleregistered before the authenticator (see Authentication). - The SLIMRPC binding is out of scope for the published crates' audit
surface. It pulls 387 transitive dependencies (normal edges, measured on 2026-10-25 at
the locked
agntcy-slim-rpc3.4.6) including a native C crypto build, which is why it lives outside the workspace with its own lockfile and its owncargo-denyrun.
Reporting a vulnerability
Do not open a public issue. Open a draft security
advisory, or
email the address in this project's copyright headers. SECURITY.md carries the
full policy, including the 90-day coordinated-disclosure timeline and what to
include in a report.