Security rules
NGB098: TLS certificate validation disabled
Reports code and configuration that switch off TLS certificate validation for Node.js clients (SSR servers, BFFs, build and tooling scripts): process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0", rejectUnauthorized: false / strictSSL: false in TLS, https.Agent, axios, got or request options, and NODE_TLS_REJECT_UNAUTHORIZED=0 in .env files and package.json scripts..
| Property | Value |
|---|---|
| Rule ID | NGB098 |
| Category | Security configuration |
| Default severity | high |
| CWE | CWE-295 |
| 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
Reports code and configuration that switch off TLS certificate validation for Node.js clients (SSR servers, BFFs, build and tooling scripts): process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0", rejectUnauthorized: false / strictSSL: false in TLS, https.Agent, axios, got or request options, and NODE_TLS_REJECT_UNAUTHORIZED=0 in .env files and package.json scripts.
Why it matters
Without certificate validation, TLS still encrypts but no longer authenticates the server: anyone on the network path can impersonate the API, read the credentials and session cookies the SSR server forwards, and return forged data that is then rendered to users. NODE_TLS_REJECT_UNAUTHORIZED=0 disables validation for every connection of the process, including database and identity-provider calls.
Detection behavior and supported patterns
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"(also element access and numeric0){ rejectUnauthorized: false }/{ strictSSL: false }object properties in TypeScript / JavaScriptNODE_TLS_REJECT_UNAUTHORIZED=0in.env*files andpackage.jsonscripts (medium severity)
Example
const agent = new https.Agent({ rejectUnauthorized: false });Safer alternative
const agent = new https.Agent({ ca: readFileSync('certs/internal-ca.pem') });Remediation
Remove the override. For internal or self-signed certificates, pass the issuing CA (ca: fs.readFileSync('internal-ca.pem') or NODE_EXTRA_CA_CERTS) so validation stays on.
False-positive considerations
- Code that only talks to a loopback service with a self-signed certificate is reported; trust that certificate explicitly with
ca:instead.
Known limitations
- Custom
checkServerIdentitycallbacks and certificate pinning bypasses are not analyzed. - Angular dev-server proxy
"secure": false(development only) is not reported. - Values set in CI configuration or the deployment environment are not visible.
References
Run it
ngbastion explain NGB098