# HumanMirror Sanitize Shield

`POST https://humanmirror.fr/api/v1/sanitize/shield/`

Sanitize Shield analyzes bounded text or structured JSON from an untrusted source before it enters an agent context window. Version 1.1 adds NFKC normalization, entropy signals and bounded decoding of Base64-like instruction payloads before applying override, secret-access, exfiltration and tool-execution rules. It returns a deterministic risk score, a `CLEAN`, `REVIEW`, or `QUARANTINED` verdict, a neutralized payload, privacy-preserving findings, and a signed Cleanliness Proof.

## Request

~~~json
{
  "payload": {"source": "external-document", "content": "Release notes for version 2.0"},
  "context": {"trust_level": "untrusted"},
  "policy": {"false_positive_cost": 1, "false_negative_cost": 4},
  "options": {"return_sanitized": true}
}
~~~

The payload can be a string, object, array, number, boolean, or null. The canonical JSON representation is limited to 65,536 bytes, 16 levels of nesting, and 1,000 items per array.

## Asymmetric decision rule

~~~text
false_positive_cost / (false_positive_cost + false_negative_cost)
~~~

A higher false-negative cost lowers the threshold and makes quarantine stricter. A caller may supply an explicit `block_threshold` between `0.01` and `0.99`.

## Cleanliness Proof

~~~text
hm_clean_v1.<base64url claims>.<HMAC-SHA256 signature>
~~~

Claims bind the proof to the exact input digest, sanitized output digest, risk score, verdict, issue time and five-minute expiry. Findings expose only category, path, offset and an evidence digest; matched source text is not repeated.

## Quota and x402

Each privacy-preserving requester fingerprint receives three test calls per rolling 24-hour window. The next unpaid request receives `HTTP 402 Payment Required` and a `PAYMENT-REQUIRED` header for an exact `0.001 USDC` transfer on Base (`eip155:8453`). A paid retry supplies `PAYMENT-SIGNATURE`; successful execution is settled before `PAYMENT-RESPONSE` is returned.

Official Base USDC contract: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`.

OpenAPI: https://humanmirror.fr/m2m/sanitize-shield.openapi.json

Manifest: https://humanmirror.fr/.well-known/sanitize-shield.json
