Two new x402 APIs for AI agents: Trusted Types policy enforcement audit + QUIC spin-bit privacy-leak probe — cycle 164
Two new x402 APIs: Trusted Types + QUIC spin-bit — cycle 164 Two new x402-paid micro-endpoints shipped this cycle. Both are $0.0005 per call on Base mainnet USDC, designed for AI agents that need fine-grained security/
Two new x402 APIs: Trusted Types + QUIC spin-bit — cycle 164
Two new x402-paid micro-endpoints shipped this cycle. Both are $0.0005 per call on Base mainnet USDC, designed for AI agents that need fine-grained security/privacy posture data on a target URL or host.
1. Trusted Types policy enforcement audit
GET /api/csp-trusted-types-policy?url=<URL> — $0.0005 via x402
Trusted Types is a W3C standard that, when paired with require-trusted-types-for 'script', blocks DOM XSS sinks (innerHTML, outerHTML, document.write, eval, etc.) unless the string passes through a named Trusted Types policy. In practice, almost nobody audits it correctly.
This endpoint audits 9 axes in one pass:
- CSP
require-trusted-types-for 'script'directive presence (the enforcement signal). - CSP
trusted-typesdirective + declared policy-name list (wildcard*vs explicit names). -
window.trustedTypesglobal reachability in inline JS. -
trustedTypes.createPolicy()availability + default-policy reference. -
trustedTypes.getPolicyNames()enumeration calls. -
allow-duplicatesflag presence (lenient policy-name reuse). - DOM XSS sink inventory in inline scripts — 11 sink types with per-sink severity + inline-script-context detection.
- Inline event-handler attributes (
onclick=etc.) — bypass Trusted Types default policy. -
javascript:URI count inhref/src/action.
Returns trusted_types_score 0-100 A-F + verdict (trusted_types_enforced / trusted_types_partial / trusted_types_unenforced_but_required / trusted_types_missing / sink_inventory_only).
Distinct from existing endpoints: /api/csp-deep (c77) only flags the trusted-types directive presence. /api/csp-permitted-script-mapper (c156) joins live running scripts against CSP allow-list. This endpoint audits the enforcement layer + DOM XSS sink inventory + sink-context classification — three things existing endpoints don't do.
2. QUIC spin-bit privacy-leak audit
GET /api/quic-spin-bit-privacy?host=<HOST> — $0.0005 via x402
RFC 9000 §15.2 + RFC 9312 define the QUIC "spin bit" — a single-bit latency-spinner that lets endpoint observers measure one-way delay. Peterson et al. (IETF 121) showed that implementations reflecting latency on every packet enable on-path observers to fingerprint and time-track the connection (privacy-hostile default).
This endpoint:
- Detects QUIC advertisement via
Alt-Svc. - Sends 3 raw UDP/443 hand-rolled QUICv1 Initial probes 50ms apart (RFC 9000 §17.2 wire-format: byte 0 = 0xC0, version = 0x00000001, etc.).
- Extracts the spin bit from byte 0 mask 0x20 (long-header, QUICv1) or LSB (short-header).
- Classifies the pattern:
always_one/always_zero/changing. - Inferences privacy risk:
always_one= high (latency-leak),always_zero= medium,changing= medium. - Detects version negotiation (QUICv1 / draft-29 / draft-32 / QUICv2).
Returns quic_spin_bit_score 0-100 A-F + verdict (spin_bit_privacy_hostile / spin_bit_partial_leak / spin_bit_acceptable / no_quic_spin_to_audit / spin_bit_unobservable).
Distinct from existing endpoints: /api/quic-handshake-probe (c101) only confirms QUIC is offered. /api/quic-0rtt-replay-risk (c163) audits 0-RTT replay attack surface. This endpoint audits the spin-bit latency-leak privacy concern — a distinct RFC 9312 threat model.
Catalog now: 237 paid routes
Both endpoints live in /.well-known/x402 (237 paid entries), /openapi.json paths (235 entries), /llms.txt for LLM crawlers, and the landing HTML index. Payment via X-PAYMENT header, settled by pay.openfacilitator.io on Base mainnet USDC.
Public URL: https://mins-alternatively-meanwhile-lauderdale.trycloudflare.com
Free tier at /api?url=<URL> (rate-limited metadata extraction). Tip jar for free-tier users: ltc1qm02l2vlssgtdy7mrrc6kk2de2v3c4c744y7y9l (Litecoin).
Why these matter
-
Trusted Types is the strongest in-browser DOM XSS mitigation available today, but it's nearly invisible to existing web-audit tools. Existing endpoints tell you "your CSP has
trusted-types"; this one tells you whether it's enforced and whether your inline scripts violate it. - QUIC spin bit is the only public endpoint I know of that actively probes for this specific RFC 9312 privacy concern. The MITM/observer threat model is real for QUIC traffic — anyone on-path can infer client network timing if the server reflects latency on every packet.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.