nuxt-security-patterns-v1Certifiedv1.0.0

Nuxt security patterns

Always-on secure coding patterns for Nuxt (safe; no dependency edits).

Protects against

Rule body

# Nuxt security patterns

Safe, always-on code patterns that reduce security risk without changing your dependency graph.

These rules use ONLY pattern-level verbs (ALWAYS/NEVER). They MUST NOT prescribe dependency upgrades.

### CVE-2021-3749 — safe patterns

- NEVER pass untrusted or user-controlled HTTP response data to custom header parsers without size limits.
- ALWAYS validate the count and length of header values before processing them through regex patterns.
- NEVER process headers from untrusted sources using complex regular expressions without timeouts or limits.

### CVE-2021-23337 — safe patterns

- NEVER pass user-controlled input directly to template functions.
- ALWAYS compile templates from static, trusted code only.
- NEVER use template delimiters that process JavaScript expressions from external sources.

### CVE-2025-27152 — safe patterns

- NEVER construct axios request URLs from user input or untrusted data sources.
- ALWAYS validate that request URLs are relative paths before passing to axios when baseURL is configured.
- ALWAYS use URL parsing to reject or sanitize any input containing protocol schemes or hostnames.
- NEVER assume baseURL will prevent requests to arbitrary domains when absolute URLs are provided.

### CVE-2026-25639 — safe patterns

- NEVER spread untrusted objects into configuration merge operations without validation.
- ALWAYS use Object.assign with explicit property whitelisting for config merges.
- NEVER assume object spread operators safely handle reserved properties like __proto__.

### CVE-2026-4800 — safe patterns

- NEVER construct _.template options.imports keys from untrusted input.
- ALWAYS validate and allowlist key names before adding to template imports.
- NEVER use user-controlled data as import names without sanitization.

### CVE-2026-42043 — safe patterns

- NEVER rely solely on hostname string matching for NO_PROXY validation without subnet normalization.
- ALWAYS normalize and canonicalize hostnames to a single form before comparing against NO_PROXY rules.
- NEVER allow requests to loopback ranges (127.0.0.0/8, ::1) to bypass proxy filtering.
- ALWAYS validate that proxy bypass rules account for all canonical IP address representations.

### CVE-2026-42033 — safe patterns

- NEVER assume co-dependencies are safe from prototype pollution; treat Object.prototype as potentially malicious.
- ALWAYS validate response data integrity independently when using axios with untrusted or legacy dependencies.
- NEVER rely on axios request interception alone for security; implement additional transport-layer validation.
- ALWAYS audit dependency trees for known prototype pollution vulnerabilities before deployment.

### CVE-2026-42035 — safe patterns

- NEVER rely on duck-type checking to identify FormData or stream objects without explicit type validation.
- ALWAYS validate that header sources (custom, merged, or programmatic) come from controlled application code only.
- NEVER use unsanitized user input or third-party data to populate Object.prototype or prototype chains.
- ALWAYS prefer explicit constructor checks or instanceof over property-existence checks for type detection.

### CVE-2025-27415 — safe patterns

- Configure CDN cache keys to respect query strings where payloads alter representations.
- Upgrade Nuxt to a patched release that closes unsafe payload rendering paths.