
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
hardened-https-agent
Advanced tools
A security-first https.Agent for Node.js that adds critical layers of trust to your HTTPS requests. Enforce modern security policies with support for Certificate Transparency, advanced revocation checks (CRLSet, OCSP), and custom CAs.
A security-first https.Agent for Node.js with advanced certificate validation: Custom CA, Certificate Transparency (CT), OCSP, and CRLSet.
A quick search on GitHub reveals a recurring pattern: developers are surprised to learn that Node.js does not validate TLS certificates the same way a browser does. Issues have been raised in popular projects like got and Uptime Kuma when users discover that connections to servers with revoked certificates succeed without any warning.
This behavior is, in fact, (more or less) intentional. As explained in the Node.js repository itself (#16338), performing robust, browser-grade checks for things like certificate revocation is a complex task with performance and privacy trade-offs. Node.js provides the necessary cryptographic building blocks, but leaves the responsibility of implementing these advanced security policies entirely up to the developer.
This is where hardened-https-agent comes in: an enhanced https.Agent for Node.js that does the heavy lifting to bridge this gap, providing modern security policies for your outbound TLS connections.
It is a drop-in replacement that works with any library supporting the standard https.Agent, including axios, got, node-fetch, needle, and more.
hardened-https-agent| Verification Check | Default Node.js (https.Agent) | hardened-https-agent |
|---|---|---|
| Trust Model | ||
| Custom CA Store | ⚠️ (Optional ca prop.) | ✅ (Enforced, with helpers) |
| Certificate Revocation | ||
| OCSP Stapling | ⚠️ (Raw staple, not validated) | ✅ |
| OCSP Direct | ❌ | ✅ |
| CRLs | ⚠️ (Manual CRL file only) | ⏳ (Planned) |
| CRLSet | ❌ | ✅ |
| CRLite | ❌ | ⏳ (Planned) |
| Certificate Integrity | ||
| Certificate Transparency (CT) | ❌ | ✅ |
See BACKGROUND.md: Why a Hardened Agent? for a detailed technical explanation of the gaps in Node.js's default behavior.
This agent is designed for any Node.js application or library that needs to reliably verify the authenticity of a remote server. Its primary goal is to protect against connecting to servers using revoked or mis-issued certificates, a check that Node.js does not perform by default. It is essential for securing backend services, hardening client libraries (like SDKs), or protecting applications in trust-minimized environments like TEEs or AI agents. The library ships with a set of pre-defined policies for common needs, while also providing complete control to create a tailored policy that fits your exact security requirements.
npm install hardened-https-agent
You can integrate this agent with HTTPS clients that support providing a Node.js https.Agent instance (e.g., axios, got, needle, etc.).
By simply using this setup, you immediately benefit from all the built-in security layers: CA validation using the Cloudflare bundle, certificate revocation checks via OCSP (stapling and direct), CRLSet-based revocation with signature verification (using the latest Google CRLSet), and enforcement that the presented certificate is properly published in Certificate Transparency logs. All of this is enabled out of the box—no extra configuration required.
import axios from 'axios';
import { HardenedHttpsAgent, defaultAgentOptions } from 'hardened-https-agent';
const agent = new HardenedHttpsAgent({
...defaultAgentOptions(),
});
const client = axios.create({ httpsAgent: agent, timeout: 15000 });
await client.get('https://example.com');
Additional real-world examples (axios, got, native https module, custom policies and more) are available in the examples directory.
If your preferred client is missing, feel free to open an issue to request an example or confirm compatibility.
| Property | Type | Required / Variants | Helper(s) |
|---|---|---|---|
ca | string | Buffer | Array<string | Buffer> | Required. Custom trust store that replaces Node.js defaults. Accepts PEM string, Buffer, or an array of either. | cfsslCaBundle, defaultAgentOptions().ca |
ctPolicy | CertificateTransparencyPolicy | Optional. Enables CT when present. Fields: logList: UnifiedCTLogList, minEmbeddedScts?: number, minDistinctOperators?: number. | basicCtPolicy(), unifiedCtLogList |
ocspPolicy | OCSPPolicy | Optional. Enables OCSP when present. Fields: mode: 'mixed' | 'stapling' | 'direct', failHard: boolean. | basicStaplingOcspPolicy(), basicDirectOcspPolicy() |
crlSetPolicy | CRLSetPolicy | Optional. Enables CRLSet when present. Fields: crlSet?: CRLSet, verifySignature?: boolean, updateStrategy?: 'always' | 'on-expiry'. | basicCrlSetPolicy() |
enableLogging | boolean | Optional (default: false). | |
| Standard HTTPS opts | https.AgentOptions | Optional. Any standard Node.js https.Agent options (e.g., keepAlive, maxSockets, timeout, maxFreeSockets, maxCachedSessions) can be merged alongside the hardened options. |
All options are thoroughly documented directly in the library via JSDoc comments for easy in-editor reference and autocomplete.
Import convenience presets and building blocks as needed:
import {
defaultAgentOptions,
cfsslCaBundle,
unifiedCtLogList,
basicCtPolicy,
basicMixedOcspPolicy,
basicStaplingOcspPolicy,
basicDirectOcspPolicy,
basicCrlSetPolicy,
} from 'hardened-https-agent';
Bring your own CA bundle:
new HardenedHttpsAgent({
...defaultAgentOptions(),
ca: myPemStringOrBuffer,
});
Tune standard agent behavior:
new HardenedHttpsAgent({
...defaultAgentOptions(),
keepAlive: true,
maxSockets: 50,
});
Use a custom CT policy:
new HardenedHttpsAgent({
...defaultAgentOptions(),
ctPolicy: {
logList: unifiedCtLogList,
minEmbeddedScts: 3,
minDistinctOperators: 3,
},
});
Use a custom OCSP policy:
new HardenedHttpsAgent({
...defaultAgentOptions(),
ocspPolicy: { mode: 'stapling', failHard: true },
});
USe a custom CRLSet policy:
new HardenedHttpsAgent({
...defaultAgentOptions(),
crlSetPolicy: {
verifySignature: true,
updateStrategy: 'always',
},
});
Enable detailed logs:
new HardenedHttpsAgent({
...defaultAgentOptions(),
enableLogging: true,
});
We welcome contributions of all kinds! A great place to start is by checking out the Roadmap for planned features or looking at the open issues for bugs and feature requests.
Before you get started, please take a moment to review our CONTRIBUTING.md guide, which contains all the information you need to set up your environment and submit your changes.
hardened-https-agent is distributed under the MIT license.
FAQs
A security-first https.Agent for Node.js that adds critical layers of trust to your HTTPS requests. Enforce modern security policies with support for Certificate Transparency, advanced revocation checks (CRLSet, OCSP), and custom CAs.
The npm package hardened-https-agent receives a total of 4 weekly downloads. As such, hardened-https-agent popularity was classified as not popular.
We found that hardened-https-agent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.