Tom Boucher
62db008570
security: add prompt injection guards, path traversal prevention, and input validation
Defense-in-depth security hardening for a codebase where markdown files become
LLM system prompts. Adds centralized security module, PreToolUse hook for
injection detection, and CI-ready codebase scan.
New files:
- security.cjs: path traversal prevention, prompt injection scanner/sanitizer,
safe JSON parsing, field name validation, shell arg validation
- gsd-prompt-guard.js: PreToolUse hook scans .planning/ writes for injection
- security.test.cjs: 62 unit tests for all security functions
- prompt-injection-scan.test.cjs: CI scan of all agent/workflow/command files
Hardened code paths:
- readTextArgOrFile: path traversal guard (--prd, --text-file)
- cmdStateUpdate/Patch: field name validation prevents regex injection
- cmdCommit: sanitizeForPrompt strips invisible chars from commit messages
- gsd-tools --fields: safeJsonParse wraps unprotected JSON.parse
- cmdFrontmatterGet/Set: null byte rejection
- cmdVerifyPathExists: null byte rejection
- install.js: registers prompt guard hook, updates uninstaller
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 11:38:26 -04:00
..
2026-03-19 12:25:59 -04:00
2026-03-15 19:31:01 -06:00
2026-03-17 11:41:44 -04:00
2026-03-20 13:24:19 +08:00
2026-03-19 21:29:25 +05:00
2026-03-20 14:56:28 +01:00
2026-03-19 20:08:50 -05:00
2026-03-20 11:38:26 -04:00
2026-03-18 23:39:47 -04:00
2026-02-26 05:49:31 +10:00
2026-02-27 11:34:36 -06:00
2026-02-26 05:49:31 +10:00
2026-03-18 23:10:56 +01:00
2026-03-20 10:38:57 -04:00
2026-03-19 15:05:20 -04:00
2026-03-18 09:55:55 -06:00
2026-03-18 09:57:33 +00:00
2026-03-19 15:05:20 -04:00
2026-03-18 09:55:55 -06:00
2026-03-18 09:55:55 -06:00
2026-03-20 11:38:26 -04:00
2026-03-17 12:04:02 -04:00
2026-03-15 11:45:25 -06:00
2026-03-19 21:30:41 +05:00
2026-03-18 19:20:58 -04:00
2026-03-20 11:38:26 -04:00
2026-03-19 15:05:20 -04:00
2026-03-18 09:55:55 -06:00
2026-03-19 00:05:05 -05:00
2026-03-17 11:08:32 -04:00
2026-02-26 05:47:19 +10:00