Sample audits · Open-source projects, first eight

helmetjs/helmet

Security headers for Express.

Summary card for this audit: 7 findings after review, 0 High, 0 Medium, 5 Low, 2 Info
Auditedhelmetjs/helmet at commit 876101e394f4936cdd1304a2e37b2509d52ed5c7
Date11 October 2026 (audited again; first audit 11 October 2026)
How it ranlocal run on our workstation, full audit, Standard review
Verdict after reviewPass with notes (Fail if a High finding remains after review, otherwise Pass with notes)
0
High after review
0
Medium after review
5
Low after review
2
Info after review
0
excluded on review

Compared with the first audit

Same commit as the first audit: the project's default branch has no later commits (checked 11 October 2026), so nothing could have been fixed upstream in between. Each finding of the first audit (11 October 2026) was checked again against the code audited now. 3 findings in the first audit; 3 still open (3 found again, 0 not reported again but still present). This audit has 7 findings after review, 4 of them new.

First auditFindingReviewed rating thenNowIn this audit
#1"Does not take options" warning duplicated 5xInfoStill open#1
#2Standalone middleware packages never build-testedInfoStill open#3
#3CSP directive given as one-shot iterable drained by validationLowStill open#6
How to read this page

Each finding keeps the number it has in the audit report. The rating shown first is the one after review; the first automated rating is listed with it. 2 findings were first rated Medium or High; 0 of them are Medium or High after review. Text marked "From the report" is quoted from the audit report; fixes are suggestions and were not tested. Code locations link to the file and line at the audited commit.

Low after review (5)

1. Low Alias-conflict and no-options handling copied across the top-level option parser
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#1)
Location: index.ts:187 (same pattern at lines 206, 228, 247, 268, 286, 311, 332; the warning branch at 168, 221, 261, 325, 346)
From the report
Evidence
if ("strictTransportSecurity" in options && "hsts" in options) {
  throw new Error(
    "Strict-Transport-Security option was specified twice. Remove the `hsts` option to fix this error.",
Why it matters

the "specified twice" check is pasted by hand for eight option pairs, and the "does not take options" warning branch for five middlewares, each with its own message and its own switch on undefined/true/false/default. Today they behave the same, but each new header or alias means another hand-copied block. Messages and default handling can drift apart, and a missed case only shows up as wrong behaviour.

Suggested fix, not tested

drive the parser from one table of entries (header name, primary key, legacy key, default on or off, whether it takes options). Use one helper that resolves the alias, throws on a conflict, warns on unexpected options and creates the middleware. A new header then needs one table row.

3. Low Standalone per-middleware packages are never built or installed by a test
First rating: Low · Reviewed rating: Low · Review: confirmed · also in the first audit (#2)
From the report
Evidence
if (middlewareToBuild) {
  const middlewareDir = path.join(rootDir, "middlewares", middlewareToBuild);
  entry = path.join(middlewareDir, "index.ts");
Why it matters

the build has a separate path for the thirteen standalone packages. That path is CommonJS only, emits only index.d.cts, merges package-overrides.json over the generated manifest, and ships different README/CHANGELOG files. The only packaging test, test/project-setups.test.ts, runs npm run build with no argument, so it only builds and installs the main package. A broken manifest, export map or type file in a standalone package would only be found after publishing.

Suggested fix, not tested

add a test or CI step that builds each directory under middlewares/, installs each tarball into a clean project, then requires and calls the middleware. The main package already gets this check.

4. Low Declared minimum Node versions are not exercised in CI
First rating: Low · Reviewed rating: Low · Review: confirmed · new in this audit
From the report
Evidence
node-version: [22.x, 24.x, 26.x]
Why it matters

the main package declares "node": ">=18.0.0" and most standalone packages declare "node": ">=10.0.0", but CI only runs Node 22 and later. The current source of the Node-10 packages only uses syntax that Node 10 supports, but nothing enforces that. A newer language feature or built-in added to one of them would break users on older runtimes the package still claims to support.

Suggested fix, not tested

add the oldest declared Node version to the matrix, running at least the built-package smoke tests. Or raise the engines fields to the oldest version actually tested.

6. Low One-shot iterables as CSP directive values are consumed by validation
First rating: Medium · Reviewed rating: Low · Review: rated too high · also in the first audit (#3)
Location: middlewares/content-security-policy/index.ts:186 (consumed again at line 235)
From the report
Evidence
for (const element of directiveValue) {
  if (typeof element !== "string") continue;
  throwErrorIfExists(
Why it matters

the public option type accepts any Iterable as a directive value. At setup, the middleware walks the value once to validate it and then stores the same object. Arrays and Sets are turned into a fixed string, but any other iterable, such as a generator, takes the per-request path and gets walked again at line 235. By then a one-shot iterator is already used up, so every response sends the directive with no sources (for example a bare script-src). The policy is then silently different from the one configured: either far stricter, breaking the site, or not what was intended. No error is raised.

Suggested fix, not tested

turn each directive value into an array once at setup (Array.from(rawDirectiveValue)), then validate and serve from that array. Or narrow the accepted type to arrays and Sets and reject other iterables with a clear error.

7. Low Build helper spawns npm without an error handler and without Windows resolution
First rating: Medium · Reviewed rating: Low · Review: rated too high · new in this audit
From the report
Evidence
const proc = childProcess.spawn("npm", args, {
  cwd,
  stdio: ["inherit", "ignore", "inherit"],
Why it matters

the promise wrapper only listens for close. If the process cannot be started, the child process emits an error event that nothing handles, and it throws as an uncaught exception instead of rejecting the promise. This happens on Windows, where npm is a .cmd shim that spawn cannot launch without a shell, or wherever npm is not on the PATH. So npm run build (packing step) and the project-setup tests crash with an unhelpful error for contributors on Windows, and the callers' error handling never runs.

Suggested fix, not tested

add proc.on("error", reject). Resolve the command per platform: use npm.cmd on win32, or pass shell: true there with fixed arguments.

Info after review (2)

2. Info Allow-list option validation re-implemented in four middlewares
First rating: Info · Reviewed rating: Info · Review: confirmed · new in this audit
Location: middlewares/cross-origin-embedder-policy/index.ts:16 (same shape in cross-origin-opener-policy, cross-origin-resource-policy, x-permitted-cross-domain-policies)
From the report
Evidence
if (ALLOWED_POLICIES.has(policy)) {
  return policy;
} else {
Why it matters

four copies of the same validate-or-throw logic. The copies are probably on purpose, because each middleware also ships as its own package with no shared runtime dependency. But the reason is not written down, so a later contributor may "fix" one copy and not the others.

Suggested fix, not tested

record the decision in one short note (for example in CONTRIBUTING). Or keep a shared helper that the build inlines into each package.

5. Info Re-compressed release tarball is accepted on size alone
First rating: Low · Reviewed rating: Info · Review: rated too high · new in this audit
From the report
Evidence
await pipe(readOriginal, gunzip, gzip, writeCrushed);
Why it matters

after npm pack, the tarball is decompressed and re-compressed with a different compressor. The new file is published whenever it is smaller. Nothing checks that its content matches the packed original, so a truncated or corrupted output would look like a bigger saving and be the file handed to the publisher.

Suggested fix, not tested

after re-compressing, decompress both files and compare the bytes, or compare their SHA-256. Print the final tarball's digest and size as the last line of output, so the file that gets published is the one that was checked.

Want this for your code?

Upload a ZIP or link a public GitHub repo, pick the areas and the depth, and get findings by severity with fixes.