Validate CSP
security.validate_csp
Overview
You pass a Content-Security-Policy header value; we parse it and return structured diagnostics — duplicate directives, unknown directives, risky sources (wildcards, unsafe-inline/eval, insecure schemes), unquoted keywords, and missing protections. We never fetch external sources. Do not use this to generate a policy (use security.generate_csp) or as proof of browser enforcement.
When you review web security, you need actionable CSP defects — not vague advice from an agent guessing at header semantics.
Reliability
VERIFIABLE and deterministic: the same header and profile always give you the same defects. We recognize the directive vocabulary of W3C CSP Level 3, so a newer directive may come back as UNKNOWN_DIRECTIVE. Risk scoring reads tokens; it does not model what a browser enforces, so a low riskLevel is a clean bill on the text you sent and nothing more. Input validation (not retryable): headerValue missing or not a string; header longer than 32768 characters; profile other than strict, balanced or legacy; maxDefects outside 1 to 1000.
Context footprint
Structured defects replace prose security review. A successful call costs 1 execution credit.
When to use it
When you audit or review a CSP header during development or CI.
When you need to generate a new policy — use security.generate_csp.
Scope
Non-goals
- Does not fetch external sources
- Does not fix the policy
- validSyntax + a low riskLevel is not proof of protection — real enforcement is browser behavior, which this token-level analyzer does not model
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| headerValue | string | Yes | CSP header value without its name. |
| profile | string | No | Risk profile; omit it for balanced. |
| maxDefects | integer | No | Defect cap; omit it for 200. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| validSyntax | boolean | Yes | Whether the header is structurally valid. |
| riskLevel | string | Yes | Overall token-level risk. |
| directives | object | Yes | Purpose-bound parsed map from directive names to source-token arrays. |
| defects | array | Yes | From 0 through 1,000 bounded CSP defects, each with a stable code, severity, and safe message. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"security.validate_csp","input":{"headerValue":"default-src ''self''"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("security.validate_csp", {"headerValue":"script-src * 'unsafe-inline'"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not fetch external sources
- Does not fix the policy
- validSyntax + a low riskLevel is not proof of protection — real enforcement is browser behavior, which this token-level analyzer does not model
- Generating a policy (use security.generate_csp)
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "security.validate_csp",
"input": {
"headerValue": "script-src * 'unsafe-inline'"
}
}Examples
Risky script-src policy
{
"headerValue": "script-src * 'unsafe-inline'"
}{
"directives": {
"script-src": [
"*",
"'unsafe-inline'"
]
},
"riskLevel": "critical",
"validSyntax": true,
"defects": [
{
"code": "WILDCARD_SOURCE",
"severity": "high",
"directive": "script-src",
"message": "Wildcard source '*' in 'script-src' is overly permissive."
},
{
"code": "UNSAFE_INLINE",
"severity": "high",
"directive": "script-src",
"message": "'unsafe-inline' in 'script-src' permits inline scripts/styles."
},
{
"code": "MISSING_DEFAULT_SRC",
"severity": "medium",
"directive": "default-src",
"message": "No 'default-src' fallback; unlisted resource types are unrestricted."
},
{
"code": "MISSING_FRAME_ANCESTORS",
"severity": "medium",
"directive": "frame-ancestors",
"message": "No 'frame-ancestors'; clickjacking protection relies on X-Frame-Options only."
}
]
}Strict profile passes
{
"headerValue": "default-src 'none'; script-src 'self'; frame-ancestors 'none'; object-src 'none'",
"profile": "strict"
}{
"directives": {
"object-src": [
"'none'"
],
"default-src": [
"'none'"
],
"frame-ancestors": [
"'none'"
],
"script-src": [
"'self'"
]
},
"riskLevel": "low",
"validSyntax": true,
"defects": []
}Recommended use cases
- Audit a CSP header during a security review
- Gate CSP changes in CI
Avoid for
- Generating a policy (use security.generate_csp)
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.