@tpmjs/tools-csp-compose
Compose a Content Security Policy (CSP) header from directive configurations. Validates directives, checks for security issues, and determines if the policy is strict. Returns the formatted CSP header string, directive details, and security warnings.
Test @tpmjs/tools-csp-compose (cspComposeTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-csp-composepnpm add @tpmjs/tools-csp-composeyarn add @tpmjs/tools-csp-composebun add @tpmjs/tools-csp-composedeno add npm:@tpmjs/tools-csp-composeimport { cspComposeTool } from '@tpmjs/tools-csp-compose';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { cspComposeTool } from '@tpmjs/tools-csp-compose';
const result = await generateText({
model: openai('gpt-4o'),
tools: { cspComposeTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
policiesobjectCSP directives mapped to arrays of source values. Example: { "default-src": ["'self'"], "script-src": ["'nonce-abc123'", "https://cdn.example.com"] }
Schema extracted: 1/1/2026, 1:05:58 AM
ERROR: No README data found!
Downloads/month
0
Quality Score