Audit Frontend Code Security & Headers
ink_audit_securityAudit frontend code for client-side security flaws like DOM XSS, unsafe sinks, and plain-text token storage. Get severity ratings, recommended CSP header, and precise fixes.
Instructions
PURPOSE: Audit frontend and full-stack web code for client-side security vulnerabilities (DOM XSS, eval/Function sinks, innerHTML execution, plain-text token storage in localStorage, missing security headers, and strict CSP generation).
BEHAVIOR: Executes AST and regex static security scanning in-memory. Purely read-only; never executes or mutates the audited code, and never transmits source code over external networks. Emits severity ratings (critical, high, medium, low) and exact code remediations.
USAGE GUIDELINES:
When to use: Use prior to deployment or code review to ensure zero client-side injection vulnerabilities, secure token handling, and robust Content-Security-Policy headers.
When NOT to use: Do NOT use to validate CSS aesthetic quality, color contrast, or fluid typography rules (use ink_validate_design instead), nor for external URL penetration testing.
Alternatives: Use ink_validate_design for design system, contrast, and bidi compliance checks; use ink_run_python_tests for Python AST test suites.
RETURNS: ResultEnvelope containing 'securityScore', pass/fail boolean, structured 'findings' array with line numbers and remediations, recommended 'recommendedCspHeader', and safe authentication storage patterns.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Source code string (HTML, JavaScript, or CSS) to inspect for client-side web vulnerabilities | |
| filename | No | Virtual file path context for reporting findings (e.g., 'src/main.js' or 'index.html') | index.html |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Domain-specific typed payload returned by the tool | |
| status | Yes | Execution outcome status | |
| summary | Yes | Concise, human-readable executive summary of the tool outcome | |
| evidence | No | Audit trail, source references, and generated artifact locations | |
| warnings | Yes | Operational cautions, craft advice, or non-blocking warnings | |
| nextActions | No | Actionable sequential recommendations or subsequent tool suggestions |