Security rules

NGB097: Package manager TLS verification disabled

Reads committed package-manager configuration (.npmrc, .yarnrc, .yarnrc.yml in the project and the workspace root) and reports disabled TLS certificate verification (strict-ssl=false, yarn strict-ssl false, enableStrictSsl: false) and registries over plain HTTP (registry=http://…, @scope:registry=http://…, npmRegistryServer: "http://…")..

Property Value
Rule ID NGB097
Category Supply chain
Default severity high
CWE CWE-295, CWE-494
Built-in presets recommended: error, strict: error

Confidence is reported per finding (high, medium, low) and is independent of severity. See Reading findings.

What it checks

Reads committed package-manager configuration (.npmrc, .yarnrc, .yarnrc.yml in the project and the workspace root) and reports disabled TLS certificate verification (strict-ssl=false, yarn strict-ssl false, enableStrictSsl: false) and registries over plain HTTP (registry=http://…, @scope:registry=http://…, npmRegistryServer: "http://…").

Why it matters

Every install downloads code that runs on developer machines and in CI (postinstall scripts, build tooling). Without certificate verification, or over plain HTTP, anyone on the network path — a compromised proxy, hostile Wi-Fi, a DNS spoof — can swap packages and gain code execution with access to CI secrets. A committed .npmrc applies the setting to everyone who clones the repository.

Detection behavior and supported patterns

  • strict-ssl=false / strict-ssl = false (.npmrc, also read by pnpm), strict-ssl false (yarn 1), enableStrictSsl: false (yarn 2+)
  • registry=http://…, @scope:registry=http://…, registry "http://…", npmRegistryServer: "http://…" (loopback and private-network hosts excluded)

Example

TypeScript
strict-ssl=falseregistry=http://registry.npmjs.org/

Safer alternative

TypeScript
registry=https://registry.npmjs.org/cafile=./certs/corp-proxy-ca.pem

Remediation

Remove strict-ssl=false and use HTTPS registries. Behind a TLS-intercepting proxy, trust its CA explicitly (cafile=/path/to/corp-ca.pem or NODE_EXTRA_CA_CERTS).

False-positive considerations

  • Corporate TLS-intercepting proxies are a common reason; configure the proxy's CA with cafile= instead of disabling verification.

Known limitations

  • User-level (~/.npmrc) and CI-provided configuration, environment variables (npm_config_strict_ssl) and CLI flags are not visible.
  • Yarn 2+ unsafeHttpWhitelist and per-scope npmScopes blocks are not interpreted.

References

Run it

Shell
ngbastion explain NGB097