Skip to content

Add validator environment doctor - #49

Open
ZhiHe-ma wants to merge 1 commit into
cloudflare:mainfrom
ZhiHe-ma:feat/validator-doctor
Open

ZhiHe-ma wants to merge 1 commit into
cloudflare:mainfrom
ZhiHe-ma:feat/validator-doctor

Conversation

@ZhiHe-ma

Copy link
Copy Markdown

Summary

  • Add a zero-dependency environment doctor for the JSON validator CLIs.
  • Report the Node.js version, OS, architecture, and whether O_NOFOLLOW and O_NONBLOCK are non-zero integers, matching the validators' current rule.
  • Provide human-readable, stable JSON, and help output with exit codes 0 (ready/help), 1 (missing capability), and 2 (invalid arguments).
  • Document the narrow scope and recommend Linux/WSL when protected file-opening flags are unavailable.

Usage

node skills/security-audit/check-environment.cjs
node skills/security-audit/check-environment.cjs --json
node skills/security-audit/check-environment.cjs --help

The result covers only the JSON validators' file-reading prerequisites. It does not claim that the complete audit environment or an OS-enforced security sandbox has been verified, and it does not impose a minimum Node.js version.

Testing

  • node --test skills/security-audit/check-environment.test.cjs: 14 passed, 0 failed, 0 skipped on Node.js v24.19.0 / win32 / x64.
  • Real CLI text, JSON, help, and invalid-argument invocations were exercised. Native Windows correctly returned 1 because Node.js does not expose either required flag there.
  • Existing validator suites: 46 passed, 7 failed, 12 skipped. The same 7 findings-CLI tests fail on an unmodified archive of origin/main at c1c8a8c1471069fb0e188eeaff69b8e8db6564a8, all because the protected file-opening flags are unavailable on native Windows. This PR does not alter those tests or validators.
  • Documentation commands were run and git diff --check passed.

Pre-PR overlap and conflict check

Immediately before opening this PR, I refreshed origin/main and related open PR heads. None added these paths or an equivalent doctor command. git merge-tree --write-tree reported no text conflicts with main or PRs #25, #26, #31, #33, #34, #36, #38, #44, and #48 at their then-current heads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant