Skip to main content

Threat model and security defaults

parcely is designed with 13 security defaults that are enabled out of the box. These defaults address every class of vulnerability found in axios CVEs over the past several years.

Security defaults table

#DefenseDefaultDescription
1Reject absolute URLs when baseURL is setallowAbsoluteUrls: falsePrevents SSRF via base-URL override (CVE-2024-39338, CVE-2025-27152). URLs starting with //, http:, https:, etc. are rejected when a baseURL is configured.
2URI scheme allowlistallowedProtocols: ['http:', 'https:']Blocks file:, data:, javascript:, and other dangerous schemes before the request is made.
3Cross-origin redirect header strippingAlways onWhen following redirects to a different origin, sensitive headers (authorization, cookie, proxy-authorization, set-cookie, x-api-key, and any user-defined sensitiveHeaders) are stripped.
4Manual redirect walk with maxRedirectsmaxRedirects: 5Redirects are followed manually (not by the browser/runtime), giving parcely control over header stripping and redirect limits.
5Prototype-pollution-safe config mergingAlways onConfig merging uses an explicit allowlist copy. __proto__, constructor, and prototype keys are stripped from nested objects (CVE-2024-57965).
6CRLF injection defenseAlways onHeader names and values are validated via the native Headers API, which rejects \r\n sequences (ERR_CRLF_INJECTION).
7Optional request header allowlistallowedRequestHeaders: undefined (opt-in)When set, only listed header names are permitted. Unlisted headers throw ERR_DISALLOWED_HEADER.
8Content-type-aware JSON parsingAlways onThe response Content-Type is checked before JSON parsing. Non-JSON content types return raw text instead of crashing with SyntaxError.
9Timeout + signal combined via AbortSignal.anyAlways onTimers are always cleaned up in finally. No leaked timers, no leaked streams.
10Raw Response never exposedAlways onOnly the structured HttpResponse envelope is returned. The raw fetch Response is consumed internally.
11TLS warning for rejectUnauthorized: falseAlways on (Node)A one-shot console.warn fires when TLS certificate validation is disabled.
12Sensitive header redactionAlways onHeader values for sensitive headers are replaced with '[REDACTED]' in HttpResponse.config and HttpError.config.
13Opt-in runtime body validationOpt-in via validateWhen a Validator<T> is provided, the response body is validated after parsing. Failures produce ERR_VALIDATION.

Opting out

Each defense can be relaxed if needed:

  • Absolute URLs: set allowAbsoluteUrls: true
  • Protocol allowlist: extend allowedProtocols
  • Redirect limit: increase maxRedirects or set followRedirects: false
  • Sensitive headers: customise the sensitiveHeaders array
  • Header allowlist: omit allowedRequestHeaders (default)

Non-goals for v1

The following are intentionally out of scope for v1:

  • mTLS / client certificates
  • Minimum TLS version override
  • Host allowlists / blocklists
  • Request/response size limits
  • HSTS enforcement
  • Automatic retries (available via @parcely/retry — not in core)