skills/web-dev/web-security/SKILL.md
OWASP Top 10, CSP, CORS, XSS/CSRF prevention, auth patterns, dependency scanning
npx skillsauth add alphaonedev/openclaw-graph web-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables developers to implement and audit web security measures based on OWASP Top 10 guidelines, including CSP, CORS, XSS/CSRF prevention, authentication patterns, and dependency scanning. It focuses on protecting web applications from common vulnerabilities like injection attacks and unauthorized access.
Use this skill during web application development, security audits, or deployments. Apply it when building APIs, handling user authentication, configuring cross-origin requests, or scanning dependencies for known vulnerabilities. Ideal for projects using frameworks like Express.js or React, or when integrating third-party libraries.
openclaw web-security scan --owasp.openclaw web-security csp --policy "default-src 'self'"openclaw web-security cors --allow "https://example.com".const token = generateCSRFToken(); res.setHeader('X-CSRF-Token', token);openclaw web-security auth --check.openclaw web-security depscan --path ./package.json.To accomplish tasks, invoke the skill via OpenClaw's CLI or API. For scanning, provide project paths and flags; for configuration, output directly to code files. Always set environment variables for authentication, e.g., export $OPENCLAW_API_KEY before running commands. Example pattern: Pipe output to a file for integration, like openclaw web-security scan --output report.json. For code snippets, embed generated security code into your app; e.g., add CSP middleware in Express: app.use((req, res, next) => { res.setHeader('Content-Security-Policy', "default-src 'self'"); next(); });
openclaw web-security [subcommand] [flags]. For example, scan a project: openclaw web-security scan --project /path/to/app --key $OPENCLAW_API_KEY. API endpoint: POST to /api/web-security/scan with JSON body { "projectPath": "/path/to/app", "apiKey": "$OPENCLAW_API_KEY" }.scan --owasp --verbose: Runs full OWASP check; outputs vulnerabilities in JSON.csp --generate --domains example.com: Creates CSP string; e.g., output: "Content-Security-Policy: default-src 'self' https://example.com".cors --set --origins "http://localhost:3000": Configures CORS in a config file like { "origins": ["http://localhost:3000"], "methods": ["GET", "POST"] }.auth --pattern jwt: Generates JWT validation code; snippet: const jwt = require('jsonwebtoken'); const verify = token => jwt.verify(token, process.env.JWT_SECRET);.depscan --format npm: Scans dependencies; e.g., command: openclaw web-security depscan --path package.json --output vulnerabilities.txt./api/web-security/{subcommand}, requiring authentication via header Authorization: Bearer $OPENCLAW_API_KEY. Response format: JSON with keys like { "status": "success", "data": { ... } }.Integrate by wrapping OpenClaw calls in your build scripts or CI/CD pipelines. For example, in a GitHub Actions workflow, add: run: openclaw web-security scan --project . --key ${{ env.OPENCLAW_API_KEY }}. Use config files for persistent settings, e.g., a .openclawrc file with JSON: { "web-security": { "defaultFlags": ["--verbose"], "apiKeyEnv": "OPENCLAW_API_KEY" } }. If combining with other skills, chain outputs; e.g., use web-security scan results as input for a "web-dev" deployment skill. Ensure API keys are stored securely in env vars like $OPENCLAW_API_KEY and never hardcoded.
Handle errors by checking exit codes and response bodies. Common errors: Authentication failure (HTTP 401) if $OPENCLAW_API_KEY is invalid—fix by verifying the key format. Scan failures (e.g., "Project path not found") return code 404; resolve by providing absolute paths. For XSS prevention, if a snippet fails, catch exceptions like: try { sanitizeInput(userInput); } catch (e) { console.error(e.message); // e.g., "Invalid input detected" }. Parse JSON responses for error details, e.g., { "error": "Vulnerability detected", "code": 400 }, and retry with corrected flags. Always log errors with timestamps for debugging.
openclaw web-security scan --owasp --project /path/to/app. This outputs a JSON report; then, fix issues by adding code like: const safeQuery = db.escape(userInput); db.query(safeQuery);. Expected output: A list of vulnerabilities, e.g., { "injection": ["SQL in login endpoint"] }.openclaw web-security csp --generate --policy "script-src 'self'". Integrate the output into your server code: app.use(helmet.contentSecurityPolicy({ directives: { scriptSrc: ["'self'"] } }));. This prevents inline scripts, reducing XSS risks.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui