Vue.js Security — OWASP Top 10 Applied
This skill provides Vue-specific exploit scenarios, PortSwigger cheat sheet vectors, and production-ready defense patterns for every OWASP Top 10 category. Use it for security audits, code reviews, training materials, and hardening Vue.js applications.
How to Use This Skill
- Identify the threat category from the user's request
- Read the relevant reference file from
references/before responding - Apply the patterns — each reference contains Exploit → Prevention → Use Case for every vulnerability
Reference Files
Read the appropriate reference file based on what the user needs:
| User Asks About | Read This File |
|---|---|
| XSS, v-html, template injection, CSTI, script gadgets, mutation XSS, CSP bypass, sanitization, DOMPurify | references/injection-xss.md |
| Route guards, access control, IDOR, privilege escalation, JWT storage, auth flows, session management, MFA, token rotation | references/access-auth.md |
| API keys in bundle, .env secrets, VITE_ exposure, SRI, CDN integrity, Pinia deserialization, CI/CD supply chain, npm audit | references/data-integrity.md |
| Source maps, CORS, security headers, CSP configuration, devtools in prod, outdated npm packages, CVEs, dependency hygiene, supply-chain attacks, Vite plugin compromise, malicious Vue plugins, global mixin hijacking, PostCSS/Tailwind build-time risks, lockfile integrity, typosquatting | references/config-components.md |
| Client-side business logic, price manipulation, rate limiting, error logging, Sentry, monitoring, SSRF, URL validation | references/design-logging-ssrf.md |
If the request spans multiple categories, read all relevant files. For a full security audit, read all five.
Quick Decision Guide
When Reviewing Code
- Read the reference file matching the code's concern
- Check for the Vulnerable Pattern — does the code match it?
- Suggest the Secure Pattern as the fix
- Explain using the Use Case scenario for context
When Creating Training Material
- Read all five reference files
- Use the Exploit → Prevention → Use Case structure for each topic
- Include PortSwigger vectors from
injection-xss.mdfor realistic examples - Include Vue-specific supply-chain scenarios from
config-components.md(section 5) for build-time and plugin risks - Organize by severity: Critical (A01, A02, A03, A07) → High (A04, A05, A06, A08, A10, Supply Chain) → Medium (A09)
When Auditing an Application
Walk through this checklist, reading the corresponding reference for details:
- Injection (A03) — Search for
v-html, dynamic:href,:is,v-onwith user input →injection-xss.md - Access Control (A01) — Check if API endpoints enforce auth independently of Vue Router guards →
access-auth.md - Auth (A07) — Check token storage (localStorage = bad), refresh rotation, brute-force protection →
access-auth.md - Crypto (A02) — Grep for
VITE_env vars containing secrets, check token storage →data-integrity.md - Misconfig (A05) — Check
vite.configfor sourcemaps, CORS policy, security headers, devtools flag →config-components.md - Components (A06) — Run
npm audit, check for EOL Vue 2, wildcard versions →config-components.md - Design (A04) — Look for client-side price/limit calculations sent to server →
design-logging-ssrf.md - Integrity (A08) — Check CDN scripts for SRI, CI pipeline for lockfile enforcement →
data-integrity.md - Logging (A09) — Check for global error handler, auth failure tracking, CSP reporting →
design-logging-ssrf.md - SSRF (A10) — Find features accepting user URLs (import, preview, upload) →
design-logging-ssrf.md - Supply Chain — Audit Vite plugins, Vue plugins using
app.mixin(), PostCSS chain, lockfile integrity →config-components.md
Output Formats
Adapt output format to what the user needs:
- Code review comment: Point to the vulnerable line, explain the risk, provide the fix inline
- Audit report: Use the Severity → Finding → Evidence → Recommendation → Reference structure
- Training material: Use the Exploit → Prevention → Use Case structure with code examples
- Security checklist: Use the 10-point checklist above with pass/fail for each item
- Fix PR: Provide the secure code replacement with a brief explanation of what changed and why
Key Principles
- Client-side guards are UX, not security. Every API endpoint must independently verify authorization.
v-htmlwith user input is always a vulnerability. Use{{ }}interpolation or DOMPurify with strict allowlists.- Vue template expressions execute JavaScript. If user input reaches a Vue template, it's code execution via
constructor.constructor(). - httpOnly cookies, not localStorage. Any XSS makes localStorage tokens instantly exfiltrable.
- Validate on the server. Client-side computed properties for prices, limits, or roles are trivially bypassed.
- Source maps expose everything. Always set
sourcemap: falsefor production builds. - Vet Vite plugins like server middleware. They run arbitrary Node.js at build time with full env access — a compromised plugin bypasses all runtime defenses.
- Prefer composables over app.use() plugins. Global mixins from
app.use()run inside every component silently; composables are explicitly scoped.
Source: aleksmiller/skills — distributed by TomeVault.