Repository navigation
Description
Summary
Both validator CLIs (validate-findings.cjs and validate-coverage-ledger.cjs) fail to read any input file on Windows. fs.constants.O_NOFOLLOW and fs.constants.O_NONBLOCK are undefined on win32, so readFileWithinLimit() throws SafeInputError("OS no-follow and nonblocking input protection is unavailable") unconditionally. Since VALIDATION-AND-REPORTING.md (Phase 4) treats the validators as a hard gate ("Fix every structural and semantic error before continuing"), a full audit run on Windows cannot complete its structured-output phase.
The two bundled test suites also disagree with each other on Windows, which suggests the gating is incomplete rather than fully intentional (details below).
Environment
- OS: Windows x64 (NT build 26300)
- Node: v24.15.0
- Installed from
mainon 2026-10-28 vianpx skills add https://github.com/cloudflare/security-audit-skill --skill security-audit
Steps to reproduce
node -e "const fs = require('fs'); console.log(fs.constants.O_NOFOLLOW, fs.constants.O_NONBLOCK)"
# undefined undefined
echo '{"x":1}' > findings.json
node skills/security-audit/validate-findings.cjs findings.json
# stderr: Failed to read findings JSON: OS no-follow and nonblocking input protection is unavailable
# exit code 1
node skills/security-audit/validate-coverage-ledger.cjs coverage-ledger.json
# stderr: Failed to read coverage ledger: OS no-follow and nonblocking input protection is unavailable
# exit code 1
node skills/security-audit/validate-findings.test.cjs
# tests 34, pass 22, fail 7, skipped 5
node skills/security-audit/validate-coverage-ledger.test.cjs
# tests 31, pass 24, fail 0, skipped 7Root cause
readFileWithinLimit() in both validators requires POSIX-only open flags:
// skills/security-audit/validate-findings.cjs (readFileWithinLimit, line ~604 on main)
// skills/security-audit/validate-coverage-ledger.cjs (readFileWithinLimit, line ~721 on main)
const noFollow = fs.constants.O_NOFOLLOW;
const nonBlock = fs.constants.O_NONBLOCK;
if (!Number.isInteger(noFollow) || noFollow === 0 || !Number.isInteger(nonBlock) || nonBlock === 0) {
throw new SafeInputError("OS no-follow and nonblocking input protection is unavailable");
}On Windows, libuv/Node do not expose O_NOFOLLOW or O_NONBLOCK (both are undefined), so the guard rejects all input before any validation runs.
The test suites are inconsistent about this
Both test files define the same platform gate and use it to skip CLI tests where safe-open is unavailable:
const HAS_SAFE_INPUT_OPEN = Number.isInteger(fs.constants.O_NOFOLLOW) &&
fs.constants.O_NOFOLLOW !== 0 &&
Number.isInteger(fs.constants.O_NONBLOCK) &&
fs.constants.O_NONBLOCK !== 0;validate-coverage-ledger.test.cjsgates all of its CLI tests behind{ skip: !HAS_SAFE_INPUT_OPEN }, so the suite is green on Windows (7 skipped, 0 failed).validate-findings.test.cjsgates some tests but leaves 7 CLI tests ungated, all of which expect the CLI to successfully read a file. They fail on Windows:
accepts a producer-shaped findings document through the CLICLI rejects input above the byte limit without an exception traceCLI rejects invalid UTF-8 without replacement or an exception traceCLI rejects lone-surrogate prose without changing payload semanticsCLI rejects Unicode format controls in source pathsCLI rejects input above the nesting-depth limit without an exception traceCLI rejects an oversized array without an exception trace
None of these assert the "protection unavailable" error — they assert real validation behavior, so the suite's intent appears to be that the CLI reads files on every platform.
Suggested fix
Make the guards consistent, one of two ways:
Option A — support Windows via a plain-open fallback (what I patched locally, all 34 findings tests then pass):
const raceSafeOpen =
Number.isInteger(noFollow) && noFollow !== 0 &&
Number.isInteger(nonBlock) && nonBlock !== 0;
let descriptor;
try {
descriptor = fs.openSync(
file,
raceSafeOpen ? fs.constants.O_RDONLY | noFollow | nonBlock : fs.constants.O_RDONLY,
);
} catch (error) { /* unchanged */ }Everything after the open is platform-independent and still enforced: fstat regular-file check, size limit, and UTF-8 validation. The only lost protection on Windows is symlink refusal / TOCTOU race-safety, which is meaningful for shared-infrastructure threat models but has limited relevance when the validator reads the audit's own output directory on a single-user machine.
Option B — keep rejecting, but make it consistent: document Windows as unsupported for the validators and add the missing { skip: !HAS_SAFE_INPUT_OPEN } gates to the 7 ungated tests in validate-findings.test.cjs so both suites are green (if degraded) on Windows. Users on Windows would need WSL for Phase 4.
Verified locally with Option A on the environment above:
validate-findings.test.cjs: 34 tests, 29 pass, 0 fail, 5 skipped (the intentionally platform-gated tests)validate-coverage-ledger.test.cjs: 31 tests, 24 pass, 0 fail, 7 skipped (unchanged)- Both CLIs read files and return proper schema/semantic validation errors
Activity