Security: confine non-literal fs paths in cli/** (72...
Beta tool for embedding and verifying digital authenticity in images,
Status: Beta
Brought to you by:
redosan
Originally created by: Redo-San
Baseline (2026-10-06): npm run lint → 112 security/detect-non-literal-fs-filename warnings, 72 of them inside cli/**:
| Count | File |
|---|---|
| 15 | cli/commands/certificate.js |
| 13 | cli/commands/audio_watermark.js |
| 11 | cli/utils.js |
| 11 | cli/menu.js |
| 5 | cli/commands/did.js |
| 4 | cli/commands/watermark.js |
| 4 | cli/commands/c2pa.js |
| 4 | cli/commands/pixel_injection.js |
| 3 | cli/commands/timestamp.js (plus the remaining CLI hits) |
(Other 40: 28 in scripts/**, 12 elsewhere — out of scope for this issue.)
Each hit is an fs sink whose path is not a literal, i.e. it can be influenced by CLI arguments or a previous read. Without a guard a caller can pass ../../… and write outside the intended output directory.
cli/utils.js (e.g. resolveInside(baseDir, userPath) → path.resolve + path.relative traversal check) and call it before every non-literal fs sink in cli/**.// eslint-disable-next-line security/detect-non-literal-fs-filename with a one-line justification instead of a guard.npx eslint --config .tools/Developer_Toolkit/eslint.config.mjs cli/ -f json → security/detect-non-literal-fs-filename = 0 (or every residual has an inline justification).npm run test:cli and npm run test:quick pass.npm run lint total warnings ≤ 5,555 (5,627 − 72).