Repository navigation
Conversation
Node on Windows defines neither O_NOFOLLOW nor O_NONBLOCK, so both validators refuse every input there with "OS no-follow and nonblocking input protection is unavailable", and the suites either skip their CLI tests or fail seven of them. On win32 only, when the constants are missing, readFileWithinLimit now: 1. resolves the path and refuses any \\ or // form (\\.\pipe\..., \\?\..., \\server\share), because opening one can connect to a pipe server or start SMB authentication before any check runs; 2. lstats the path with bigint: true and refuses a symbolic link (Node reports junctions as links too), anything that is not a file, or an ino of 0, which some file systems report when they have no file ID; 3. opens it read-only; 4. fstats the descriptor and refuses a non-file or a dev, ino or birth time that differs from step 2, which closes the swap between check and open. Birth time is compared too because ReFS file IDs are not guaranteed unique. The POSIX path and every other platform without the constants are unchanged. readFileWithinLimit is exported from both modules so the tests can reach the fallback directly. The CLI tests now run on win32 through the fallback. New win32 tests cover a symbolic link (skipped when the process lacks the privilege to create one), a junction, a named pipe (refused as a non-local path), a relative path that still reads, and a file deleted and recreated between lstat and open, which must fail with "input changed between check and open". On Windows 10 with Node 24: 69 pass, 0 fail, 6 skip across both suites (was 46 pass, 7 fail, 12 skip).
This was referenced Oct 8, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On native Windows, Node defines neither
fs.constants.O_NOFOLLOWnorO_NONBLOCK, sovalidate-findings.cjsandvalidate-coverage-ledger.cjsrefuse every input withOS no-follow and nonblocking input protection is unavailable. A full audit run on Windows cannot reach the "both validators pass" terminal state. The test suites hide this: the ledger suite skips its CLI tests whenO_NOFOLLOWis missing, and seven findings CLI tests fail.Change
On
win32only, when the constants are missing,readFileWithinLimittakes a fallback with the same guarantees for the final path component:\or//form (\.\pipe\...,\?\..., UNC): opening one can connect to a pipe server or start SMB authentication before any check runs.lstatwithbigint: true: refuse a symbolic link (Node reports junctions as links too), a non-file, orino0.fstatthe descriptor withbigint: true: refuse a non-file, or adev,inoor birth time that differs from step 2, which closes the swap between check and open. Birth time is compared too because ReFS file IDs are not guaranteed unique.The POSIX path, and any other platform without the constants, is unchanged.
readFileWithinLimitis exported from both modules so tests can reach the fallback.Tests
The CLI tests now run on
win32through the fallback. Newwin32tests cover a symbolic link (skipped without the privilege to create one), a junction, a named pipe, a relative path, and a file deleted and recreated betweenlstatandopen. Removing the identity check turns the swap tests red.windows-latestandubuntu-latest, Node 22: both suites green, symbolic-link test runs onwindows-latest.