Security
The security policy is in the repository:
- SECURITY.md: supported versions, how to report a vulnerability privately, and the full threat model.
Please do not report vulnerabilities in public issues. Use GitHub's private vulnerability reporting instead.
What valifetch guarantees
A summary; SECURITY.md has the exact rules.
- Prefix containment. With
prefixUrlset, the final URL keeps the prefix origin and its path stays under the prefix path. Absolute inputs such ashttps://evil.comor//evil.combecome path segments under the prefix, and a path that climbs above it with..(including%2e%2e) throws aTypeError. AprefixUrlcontaining?or#also throws aTypeError. See Requests. - Path-param encoding.
paramsvalues are percent-encoded, so they cannot add path segments, a query string or a fragment. The values.and..throw aTypeError, and params are read as own properties only. See Requests. - No header injection. Header names and values containing CR, LF or NUL are rejected by the platform
Headersclass with aTypeErrorbefore the request is sent. - Prototype-pollution-safe merging.
create()/extend()assign user-supplied keys as own data properties, so a JSON-derived__proto__key cannot change a prototype. - No secrets in built-in logs.
debug: truelogs a summary with sensitive header and query-parameter values replaced by[REDACTED]. - Bounded parsing of untrusted responses. The SSE parser caps the pending (unterminated) event at
sseMaxEventSize(default 16 MiB).Retry-Afteris parsed strictly, and a delay longer thanretry.maxRetryAfter(default 60 s) is not retried rather than waited for. Retries are always bounded byretry.limit.
What is your responsibility
- User-controlled full URLs (SSRF). Without
prefixUrl, valifetch requests whatever URL it is given. Validate any user-supplied URL against an allow-list of schemes and hosts. - Where credentials go. Auth hooks attach credentials to every request of their instance, including full URLs on other hosts. Keep credentialed instances behind a
prefixUrl. - Custom
debugfunctions receive the live, unredactedRequestandResponse. - Response size. JSON, text, blob and error bodies are read fully into memory, as with plain
fetch. Use atimeout, orresponseType: 'stream'with your own byte limit, for untrusted responses. dedupekeys on method and URL only. Do not use it for calls that differ by headers (for example per-user tokens) or body.