fix: add input validation, date range checks, and security hardening

- validate-agents.js: reject invalid model names in agent frontmatter
- package-manager.js: validate script/binary names against shell injection
- session-manager.js: reject impossible month/day values in filenames
- utils.js: support options.all for replaceInFile string patterns
- strategic-compact/SKILL.md: fix hook matcher syntax and script reference
- install.sh: warn when overwriting existing rule customizations
- Add 24 new tests covering all validation and edge cases
This commit is contained in:
Affaan Mustafa
2026-02-12 17:32:04 -08:00
parent 35aed05903
commit 926eba97c5
10 changed files with 312 additions and 10 deletions

View File

@@ -31,6 +31,11 @@ function parseSessionFilename(filename) {
if (!match) return null;
const dateStr = match[1];
// Validate date components are in valid ranges (not just format)
const [year, month, day] = dateStr.split('-').map(Number);
if (month < 1 || month > 12 || day < 1 || day > 31) return null;
// match[2] is undefined for old format (no ID)
const shortId = match[2] || 'no-id';