ECC/skills
jtzingsheim1 9661a6f042
fix(hooks): scrub secrets and harden hook security (#348)
* fix(hooks): scrub secrets and harden hook security

- Scrub common secret patterns (api_key, token, password, etc.) from
  observation logs before persisting to JSONL (observe.sh)
- Auto-purge observation files older than 30 days (observe.sh)
- Strip embedded credentials from git remote URLs before saving to
  projects.json (detect-project.sh)
- Add command prefix allowlist to runCommand — only git, node, npx,
  which, where are permitted (utils.js)
- Sanitize CLAUDE_SESSION_ID in temp file paths to prevent path
  traversal (suggest-compact.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): address review feedback from CodeRabbit and Cubic

- Reject shell command-chaining operators (;|&`) in runCommand, strip
  quoted sections before checking to avoid false positives (utils.js)
- Remove command string from blocked error message to avoid leaking
  secrets (utils.js)
- Fix Python regex quoting: switch outer shell string from double to
  single quotes so regex compiles correctly (observe.sh)
- Add optional auth scheme match (Bearer, Basic) to secret scrubber
  regex (observe.sh)
- Scope auto-purge to current project dir and match only archived
  files (observations-*.jsonl), not live queue (observe.sh)
- Add second fallback after session ID sanitization to prevent empty
  string (suggest-compact.js)
- Preserve backward compatibility when credential stripping changes
  project hash — detect and migrate legacy directories
  (detect-project.sh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): block $() substitution, fix Bearer redaction, add security tests

- Add $ and \n to blocked shell metacharacters in runCommand to prevent
  command substitution via $(cmd) and newline injection (utils.js)
- Make auth scheme group capturing so Bearer/Basic is preserved in
  redacted output instead of being silently dropped (observe.sh)
- Add 10 unit tests covering runCommand allowlist blocking (rm, curl,
  bash prefixes) and metacharacter rejection (;|&`$ chaining), plus
  error message leak prevention (utils.test.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): scrub parse-error fallback, strengthen security tests

Address remaining reviewer feedback from CodeRabbit and Cubic:

- Scrub secrets in observe.sh parse-error fallback path (was writing
  raw unsanitized input to observations file)
- Remove redundant re.IGNORECASE flag ((?i) inline flag already set)
- Add inline comment documenting quote-stripping limitation trade-off
- Fix misleading test name for error-output test
- Add 5 new security tests: single-quote passthrough, mixed
  quoted+unquoted metacharacters, prefix boundary (no trailing space),
  npx acceptance, and newline injection
- Improve existing quoted-metacharacter test to actually exercise
  quote-stripping logic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(security): block $() and backtick inside quotes in runCommand

Shell evaluates $() and backticks inside double quotes, so checking
only the unquoted portion was insufficient. Now $ and ` are rejected
anywhere in the command string, while ; | & remain quote-aware.

Addresses CodeRabbit and Cubic review feedback on PR #348.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:47:31 -08:00
..
agent-harness-construction feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
agentic-engineering feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
ai-first-engineering feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
api-design fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
article-writing feat: add generic content and investor skills 2026-02-27 05:50:23 -08:00
autonomous-loops feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
backend-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
clickhouse-io fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
coding-standards fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
configure-ecc feat: separate core vs niche skills and enforce research-first default 2026-02-28 10:06:43 -08:00
content-engine feat: add generic content and investor skills 2026-02-27 05:50:23 -08:00
content-hash-cache-pattern fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
continuous-agent-loop feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
continuous-learning feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
continuous-learning-v2 fix(hooks): scrub secrets and harden hook security (#348) 2026-03-07 14:47:31 -08:00
cost-aware-llm-pipeline fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
cpp-coding-standards fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
cpp-testing chore: replace external repo links with @username attribution 2026-03-03 12:32:35 -08:00
database-migrations fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
deployment-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
django-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
django-security fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
django-tdd fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
django-verification fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
docker-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
e2e-testing fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
enterprise-agent-ops feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
eval-harness feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
foundation-models-on-device fix(skills): improve code examples in iOS 26 skills 2026-02-24 14:39:25 +09:00
frontend-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
frontend-slides chore: replace external repo links with @username attribution 2026-03-03 12:32:35 -08:00
golang-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
golang-testing fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
investor-materials feat: add generic content and investor skills 2026-02-27 05:50:23 -08:00
investor-outreach feat: add generic content and investor skills 2026-02-27 05:50:23 -08:00
iterative-retrieval fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
java-coding-standards fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
jpa-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
liquid-glass-design fix(skills): improve code examples in iOS 26 skills 2026-02-24 14:39:25 +09:00
market-research feat: add generic content and investor skills 2026-02-27 05:50:23 -08:00
nanoclaw-repl feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
nutrient-document-processing feat: add security guides and sanitize external links across repo 2026-02-25 07:20:42 -08:00
plankton-code-quality feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
postgres-patterns chore: replace external repo links with @username attribution 2026-03-03 12:32:35 -08:00
project-guidelines-example fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
python-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
python-testing fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
ralphinho-rfc-pipeline feat: deliver v1.8.0 harness reliability and parity updates 2026-03-04 14:48:06 -08:00
regex-vs-llm-structured-text fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
search-first feat: separate core vs niche skills and enforce research-first default 2026-02-28 10:06:43 -08:00
security-review fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
security-scan fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
skill-stocktake fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
springboot-patterns fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
springboot-security fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
springboot-tdd fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
springboot-verification fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
strategic-compact fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
swift-actor-persistence fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
swift-concurrency-6-2 fix(skills): improve code examples in iOS 26 skills 2026-02-24 14:39:25 +09:00
swift-protocol-di-testing fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
swiftui-patterns fix: correct SwiftUI skill ViewModel injection and Equatable comparison 2026-02-17 17:04:31 +02:00
tdd-workflow fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
verification-loop fix: add origin metadata to skills for traceability 2026-02-23 19:00:57 +03:00
visa-doc-translate feat(skills): add visa-doc-translate skill 2026-02-20 16:25:23 +08:00