Edge terminates TLS; this Worker sanitizes JSON, masks Luhn-valid PANs,
redacts private IPs, strips debug objects, and can decrypt/re-encrypt AES-GCM field envelopes.
Live capability calls require a trusted client certificate.
Capability host rejects callers without a valid client cert.
Origin host is open for the unprotected direct fixture.
Browser vs command line: a browser cannot read a local PEM/key through page JavaScript. The browser check first runs the real Worker’s read-only structural policy against a synthetic fixture at /__rs/browser-proof, then separately shows the protected API identity result. A positive API result requires the client certificate to be installed in the browser or operating-system certificate store. The command-line section uses the operator-held certificate with curl; a hosted container or sandbox would hold that credential on behalf of the caller and would not prove the caller’s own browser identity.
Key questions
Question
Can S3 protect and scan its real payload classes without using forged identity headers?
Yes. Native request.cf.tlsClientAuth gates the capability; the Worker structurally processes 1 KiB and 500 KiB JSON and passes 10 MiB binary through unread. S3 does not transform HTML.
Success criteria / proof
Native identity gates access.Only verified native client-certificate identity is accepted; forged x-rs-mtls-* headers do not authenticate.
Response data is sanitized.Synthetic XSS strings are encoded, valid PANs are masked, private IPs are removed, public IPs remain, and debug keys are deleted.
JSON structure is preserved.The structural scan returns valid JSON and fails closed for invalid JSON or authentication errors.
Opaque payloads bypass scanning.Binary responses are forwarded without reading or modifying their bytes.
Field crypto is authenticated.AES-256-GCM envelopes use the configured key ring and reject unknown keys or authentication failures.