Content-Security-Policy audit

$0.005 USDC per call · Developer and security · POST /api/v1/csp-audit · Id csp-audit

Parses a Content-Security-Policy header or <meta> value and reports every clause that weakens it: 'unsafe-inline' without nonces or hashes, 'unsafe-eval', wildcard hosts, data:/blob: in script-src, scheme-only https:, duplicate directives (second is discarded), missing base-uri or object-src 'none', open frame-ancestors or form-action, and the strict-dynamic cases that silently ignore host sources. Returns an overall strength score and the effective source list each sensitive directive resolves to after default-src fallback. No fetches — the policy text is the input.

What you get

A copy-pasted CSP that still has 'unsafe-inline' is the single most common XSS post-mortem root cause; this flags it before deploy.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/csp-audit. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/csp-audit \
  -H 'content-type: application/json' \
  -d '{"policy":"default-src '\''self'\''; script-src '\''self'\'' '\''unsafe-inline'\'' https:; object-src '\''none'\''; base-uri '\''self'\''"}'

Input

FieldTypeRequiredDescription
policystring; length 0..8000yesThe full Content-Security-Policy value (not the header line).
deployTargetstring; one of "report-only", "enforce"noReserved for future harsher checks in enforce mode.

Example request body

{
  "policy": "default-src 'self'; script-src 'self' 'unsafe-inline' https:; object-src 'none'; base-uri 'self'"
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
policystringno
directiveCountintegerno
findingsarray<object>no
strengthstring; one of "strong", "moderate", "weak"no
strictDynamicbooleanno
effectiveobjectnoFor each sensitive directive, the resolved source list after default-src/script-src fallback.
trustedTypesobjectnoTrusted Types enforcement: whether require-trusted-types-for 'script' is set, and the trusted-types policy name list.
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the infra-preflight-kit package.

Machine-readable