Commit Graph

1 Commits

Author SHA1 Message Date
Reuven bbe53a21cd test(security): regression tests for validateEnv + fs-secure (audit_1776853149979)
Pin the recent audit fixes so they can't silently regress.

__tests__/validate-input-env.test.ts (19 cases):
  - happy path: undefined/null/empty/valid env passes through
  - loader-hijack denylist: each of the 9 denylisted names (LD_PRELOAD,
    LD_LIBRARY_PATH, LD_AUDIT, DYLD_INSERT_LIBRARIES, DYLD_LIBRARY_PATH,
    DYLD_FALLBACK_LIBRARY_PATH, DYLD_FORCE_FLAT_NAMESPACE, NODE_OPTIONS,
    NODE_PATH) gets its own assertion — adding an exemption to that list
    becomes a real CVE that future me/anyone needs to consciously delete
    a test for
  - shape: name with =, digit-first name, whitespace, non-object value,
    non-string value, null byte in value, value over 32K — all rejected

__tests__/fs-secure.test.ts (8 cases):
  - writeFileRestricted: writes string + Buffer correctly, sets mode
    0600, preserves mode on overwrite
  - mkdirRestricted: creates new + nested dirs, idempotent on existing,
    sets mode 0700
  - mode-bit assertions skipped on Windows (process.platform === 'win32')
    because chmod is a no-op there and POSIX permission bits don't apply

All 27 new tests pass. Sibling validate-input-agent-spawn.test.ts also
re-run as a regression check on the shared source file — still 4/4 passing.
2026-05-03 20:30:08 -04:00