Content-Digest proves bytes, not who assembled the response
An HTTP response can arrive with a valid TLS connection and still contain the wrong representation. A cache, compression layer, signing service, or application middleware may transform the body after the origin created it. The Content-Digest field gives a receiver a way to check particular bytes, but it does not identify the party that chose those bytes.
RFC 9530 defines integrity fields for HTTP. Content-Digest covers the message content. Repr-Digest covers a selected representation, including representation metadata that affects the decoded form. The distinction matters when content coding, range handling, or representation negotiation changes what an intermediary sends. A digest calculated over one form should not be compared with a different form and treated as an attack.
Put verification where the transformation stops
A team that adds Content-Digest at the origin has to know whether a CDN will recompress the body. If the CDN changes the content coding, the original digest may no longer describe the bytes on the wire. The safer deployment model names the producer and verifier of each digest, records which representation it covers, and rejects a response when the expected digest is absent or malformed.
The digest algorithm identifier and encoded value are part of the field syntax. Receivers should parse the structured field, choose an algorithm from an explicit allowlist, and avoid comparing an unverified value with a string assembled by hand. If several digests are present, a policy can require a strong algorithm even when a weaker one also validates.
A digest is not a signature
An attacker who can rewrite the body through a compromised application or cache can often recompute the digest too. The field becomes an authenticity control only when its value is protected by a separate signature, authenticated manifest, or other trusted channel. TLS protects traffic between endpoints, while a digest can help detect accidental corruption or a boundary mismatch. Those are different properties.
This is why a mismatch needs a defined response. A proxy might block the response, return an error, or strip the object from cache. An application might log and fail closed. A client that logs the mismatch and renders the body anyway has turned an integrity signal into monitoring noise.
Operational checks
Inventory every component that can change content: origin compression, edge compression, transcoding, malware scanning, and response rewriting. Record which component emits and validates the digest. Test a response after each hop, including an error page and an empty response. Check behavior for ranges and for content that has no body. Define how digest failures appear in logs without writing sensitive response bodies.
Content-Digest is most useful when the receiver knows exactly what it is checking and what it will do after a mismatch. The field is evidence about bytes. Authorization, origin identity, and signer trust still need separate controls.
References
[1] RFC 9530, Digest Fields. https://www.rfc-editor.org/rfc/rfc9530.html
[2] RFC 9421, HTTP Message Signatures. https://www.rfc-editor.org/rfc/rfc9421.html
Top comments (0)