Security
API security for Node.js teams: BOLA and IDOR, SSRF, CORS, API keys, rate limiting, credential stuffing and what to log to spot attacks.
A model API key leaked. The first hour, for a Node team
In October, stolen Amazon Bedrock credentials made about 2.5 million API calls before anyone stopped them. A first-hour runbook for a small Node team when a model provider key leaks: revoke, scope the damage from your own logs, then rotate the right way.
Your auth check passed. Now prove what the agent did.
An agent calls your API with a valid token, the scopes allow it, and the write lands with a clean 201. Nobody asked for it. Here's how to fix authorization for agents first, then build an audit trail that shows exactly what the agent did.
API business logic abuse: requests that are valid but wrong
Akamai says 61% of API attacks in 2025 involved unauthorized workflows, double the year before. Four examples for a small SaaS, how to map the expected order of calls, and Express code to catch the ones that skip a step.
Catch secrets before they reach git: a pre-commit check for Node repos
GitGuardian found commits co-authored by Claude Code leaked secrets at 3.2%, twice the 1.5% baseline. A 10-minute pre-commit secret scan for Node repos, a CI backstop for --no-verify, and what to do when a key slips through anyway.
Block .env and config-file probes in Express and Fastify
One site logged 1,028 requests for credential paths in a day, including /.mcp.json and other AI tool configs. How to check none can succeed, return a fast 404 in Express and Fastify, and block the IPs doing it.
Stop user enumeration on your Node.js login, signup and reset endpoints
AI agents made hundreds of millions of requests to login pages in the first half of 2026. If your API answers differently for real and unknown emails, it hands them a target list. Here's how to make login, reset and signup give one answer.
Log every LLM API call your Node app makes
October's AI platform breaches leaked model provider keys, and one stolen key ran about 800,000 calls in 30 hours. How to log every LLM call from Node with tokens, customer and a key fingerprint, then reconcile against provider usage to catch calls your code didn't make.
Lock down npm installs when an AI agent adds your dependencies
In late October, 96 malicious npm packages appeared in three days, several running code at install time. How to turn off install scripts in npm and pnpm, allow the few builds you need, and review every dependency an AI agent adds.
What small Node teams should log in the AI-attack era
Bots are now more than half of web traffic, and 27% of attacks target APIs and identity systems. You don't need a security team to see it, just the right fields on every request. Here's the minimum to capture, five patterns to watch, and when to block.
SSRF in Node.js: the fetch() you didn't mean to make
A customer pastes a webhook URL pointing at your cloud metadata endpoint, and your API fetches it. Learn how SSRF in Node.js happens, why blocklists on URL strings fail, and a tested safeFetch() you can ship today.
API key security for Node APIs: prefixes, hashing, scopes and rotation
A customer just pushed their API key to a public repo. Can you tell if anyone used it, and could a database leak expose every key? Design API key security in Node properly: prefixes, hashing, scopes and rotation.
CORS misconfiguration in Express and Fastify: how to find it and test for it
One line added to silence a frontend error, cors({ origin: true, credentials: true }), lets any website read your users' data. Find CORS misconfiguration in Express and Fastify APIs, fix it, and test it in CI.