brandkit security-scan
Scan SVG files for security threats.
Synopsis
Description
Scan SVG files for security threats that could enable XSS attacks, session hijacking, or other malicious behavior. Detects:
| Severity | Threats |
|---|---|
| Critical | Script elements, javascript: URIs, event handlers |
| High | External references, foreignObject, XML entities |
| Medium | Animation elements, anchor links (strict mode) |
| Low | Style blocks (strict mode) |
Commands
security-scan
Scan a single file or directory (non-recursive):
security-scan-all
Recursively scan all SVG files. Designed for CI pipelines:
Flags
| Flag | Description |
|---|---|
--strict |
Detect all threats including style blocks and animations (default: true) |
--report |
Output JSON report file path |
--project |
Project name for report (default: brandkit) |
--version |
Version for report (default: CLI version) |
-h, --help |
Help for security-scan |
Examples
Scan a single file:
Scan a directory:
Generate JSON report:
Standard mode (critical/high only):
Scan Levels
Strict Mode (default)
Detects all 7 threat types including low-severity issues:
- Style blocks (often benign but can contain malicious CSS)
- Animation elements (can trigger delayed attacks)
- Anchor links (unnecessary for static images)
Standard Mode
Detects only critical and high severity threats:
- Scripts and JavaScript URIs
- Event handlers
- External references
- XML entities (XXE prevention)
Output
Console Output
Scanning brands/...
✗ brands/malicious/icon.svg
CRITICAL: script element at line 5
CRITICAL: onclick handler at line 12
✓ brands/react/icon.svg: Secure
Summary: 1 file(s) with threats, 1 secure
JSON Report
The --report flag generates a JSON report following the multi-agent-spec team-report format:
{
"$schema": "...",
"title": "SVG SECURITY SCAN REPORT",
"project": "brandkit",
"version": "0.4.0",
"status": "NO-GO",
"teams": [
{
"id": "script-detection",
"name": "Script Detection",
"status": "NO-GO",
"tasks": [...]
}
]
}
Exit Codes
| Code | Meaning |
|---|---|
| 0 | No threats detected (or warnings only in standard mode) |
| 1 | Threats detected |
CI Integration
Add to your CI pipeline:
Or using Make:
See Also
- sanitize — Remove security threats
- Security Guide — Full security documentation
- Threat Types — Detailed threat descriptions