HTTP Message Signatures (RFC 9421) API Integrity Playbook

2026-03-29 ยท software

HTTP Message Signatures (RFC 9421) API Integrity Playbook

Date: 2026-03-29
Category: knowledge
Audience: API platform / security engineering / gateway owners

1) Why this matters in real systems

TLS protects a single transport hop, but many production APIs traverse multiple hops (CDN, WAF, API gateway, service mesh, app). RFC 9421 gives you a way to sign selected HTTP components end-to-end so downstream verifiers can detect tampering even across intermediary boundaries.

This is especially useful when you need:


2) What RFC 9421 gives you (and what it does not)

It gives you

It does not give you


3) Protocol facts operators should memorize

  1. Both fields are required for a valid signature:
    • Signature-Input (how signature was created)
    • Signature (actual signature bytes)
  2. Signature labels must be unique in a message and must appear in both fields.
  3. Covered component list is ordered and must be preserved.
  4. @signature-params is required in signature base construction and is the last line of the base.
  5. Derived components (e.g., @method, @target-uri, @authority, @path, @query, @status) are first-class and often safer than raw headers.
  6. Trailers are possible for signature fields, but not recommended in most deployments because intermediaries may drop trailers.

4) Coverage policy: the most important design choice

RFC 9421 security guidance is explicit: insufficient coverage means attackers can alter unsigned message parts without invalidating signatures.

Request baseline (good production default)

For state-changing API requests (POST/PUT/PATCH/DELETE), require signature coverage of:

Response baseline (if you sign responses)

Practical rule

Only trust signed components. If unsigned components can influence business logic, strip or ignore them before deeper processing.


5) Replay resistance model

Replay risk exists even when signatures verify cryptographically.

Use all three controls together:

  1. created: enforce max age (e.g., 60-300s).
  2. expires: enforce hard expiry.
  3. nonce: require uniqueness in verification window (store in Redis or similar short-TTL cache keyed by signer + nonce).

Optional active defense:


6) Payload integrity: pair RFC 9421 with RFC 9530

RFC 9421 intentionally does not directly sign opaque message content bytes. In practice:

  1. Generate Content-Digest (or Repr-Digest where representation semantics matter).
  2. Include that digest field in covered components.
  3. Verify digest first (or alongside signature base reconstruction) and fail closed.

This pattern gives you robust metadata + payload integrity together.


7) Algorithm and key policy

RFC 9421 registry starts with active algorithms such as:

Operational recommendations:


8) Gateway/proxy pitfalls (where deployments fail)

  1. Signing unstable fields
    • Example: intermediaries rewrite host, normalize paths, or reorder field formatting.
  2. Canonicalization mismatch across stacks
    • Different frameworks expose different URI/path abstractions.
  3. Mixing legacy draft-cavage signatures with RFC 9421 syntax
    • Treat as separate schemes; avoid silent dual parsing.
  4. Trailer dependence
    • Signatures in trailers can disappear in transit.
  5. Signature confusion with multiple labels
    • Enforce application-specific tag and required label policy.

9) Minimal implementation contract (what to write down in your API security spec)

Define these explicitly per protected endpoint group:

If this contract is undocumented, interop and security drift are almost guaranteed.


10) Rollout sequence (safe production path)

Phase 0 โ€” discovery

Phase 1 โ€” verify-only shadow mode

Phase 2 โ€” soft enforcement

Phase 3 โ€” strict enforcement


11) Fast incident runbook

When signature verification failures spike:

  1. Check system clock skew/NTP drift first.
  2. Inspect recent key rotations and keyid mapping updates.
  3. Diff canonicalization behavior across gateway/app versions.
  4. Separate replay failures (nonce reuse) from cryptographic failures.
  5. Check if a proxy update changed path/authority normalization.
  6. If emergency bypass is required, scope tightly by route+principal+TTL and record incident justification.

12) Example header shape (illustrative)

Signature-Input: sig1=("@method" "@authority" "@path" "content-digest");created=1711692000;expires=1711692060;nonce="n-7f4a";keyid="client-key-42";alg="ed25519";tag="payments-v1"
Signature: sig1=:Base64EncodedSignatureBytes:

(Exact covered components and parameter policy must be application-defined.)


References

  1. RFC 9421 โ€” HTTP Message Signatures
    https://www.rfc-editor.org/info/rfc9421
  2. RFC 9530 โ€” Digest Fields
    https://www.rfc-editor.org/info/rfc9530
  3. RFC 8941 โ€” Structured Field Values for HTTP
    https://www.rfc-editor.org/info/rfc8941
  4. RFC 9110 โ€” HTTP Semantics
    https://www.rfc-editor.org/info/rfc9110