Skip to content

fix(hooks): resolve security eval and session-start output schema - #117

Closed
googlarz wants to merge 4 commits into
addyosmani:mainfrom
googlarz:fix/hook-issues
Closed

googlarz wants to merge 4 commits into
addyosmani:mainfrom
googlarz:fix/hook-issues

Conversation

@googlarz

Copy link
Copy Markdown
Contributor

Summary

Fixes two issues surfaced in #106 and #110.

Fix #106 — eval injection vector in simplify-ignore-test.sh (Critical)

eval "$(sed -n '/^filter_file()/,/^}/p' hooks/simplify-ignore.sh)" extracted and eval'd a function at test-runner startup. Any future modification to simplify-ignore.sh that placed malicious content in or near filter_file would execute without review, since test runners are read with low suspicion.

Fix: restructured simplify-ignore.sh so it is safe to source:

  • All helper functions (hash_cmd, file_id, block_hash, escape_glob, filter_file) come first
  • A BASH_SOURCE guard immediately follows — sourcing stops here, so no jq check, no INPUT=$(cat), no stdin blocking
  • Hook execution logic (jq check, stdin read, dispatch) runs only when the script is executed directly
  • CACHE uses ${CACHE:-...} so callers (e.g. tests) can override via an exported variable

simplify-ignore-test.sh now sources the file with . hooks/simplify-ignore.sh — clean, no eval.

All 21 tests pass.

Fix #110 — session-start.sh uses undocumented JSON output schema

{"priority": "IMPORTANT", "message": "..."} uses fields that don't exist in the Claude Code hook schema. When CC receives JSON starting with { but with unrecognized fields, it silently ignores them — the meta-skill content was never injected.

Claude Code docs define two valid SessionStart output shapes:

  1. Plain text stdout — injected directly as additional context ✓
  2. {"hookSpecificOutput": {"additionalContext": "..."}} — correct structured schema, but broken for plugin-registered hooks (CC bug #16538 silently drops plugin SessionStart additionalContext)

Fix: switch to plain text stdout (shape 1), which works reliably for both native and plugin hooks. jq dependency removed.

Test plan

  • bash hooks/simplify-ignore-test.sh — 21/21 pass
  • bash hooks/session-start.sh — outputs plain text with meta-skill content
  • Codex review — clean pass, no findings

Fixes #106, #110

googlarz and others added 4 commits April 13, 2026 19:56
Fast-forward merged 8 upstream commits (a11y + performance checklist
improvements). Added fork note linking to the 3 open PRs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a production-grade calendar and task management skill for Claude Code.

Features:
- Rich context-aware Google Calendar entries with transcript links
- Detects scheduling conflicts before committing
- Respects work hours and user preferences via pattern matching
- Manages local task lists without external dependencies
- Optional prep blocks before meetings (user-confirmed per event)
- Supports recurring events with RRULE
- Bulk reschedule for schedule adjustments

Python implementation (calendar.py, tasks.py) handles OAuth setup,
Google Calendar API integration, and local task storage.

Comprehensive documentation includes:
- SKILL.md: Complete workflow reference and command documentation
- README.md: User guide with practical examples and troubleshooting
- INTEGRATION.md: Step-by-step guide for adding to agent-skills fork
- preferences.json: Event-type pattern matching configuration

No maintenance commitment; contributions welcome.
- simplify-ignore-test.sh: replace eval "$(sed...)" with source
  (fixes addyosmani#106 critical finding — eval of extracted file content is
  an injection vector if simplify-ignore.sh is ever modified maliciously)
- simplify-ignore.sh: add BASH_SOURCE guard so sourcing only loads
  function definitions; use ${CACHE:-...} so callers can override
- session-start.sh: switch from undocumented {priority,message} JSON
  to plain text stdout — the only reliable output path for plugin
  SessionStart hooks (hookSpecificOutput.additionalContext is dropped
  by CC bug #16538; {priority,message} fields are silently ignored)
  Fixes addyosmani#106, addyosmani#110

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@googlarz

Copy link
Copy Markdown
Contributor Author

Hi @addyosmani — this is a smaller bug fix (security eval issue + session-start output schema). Happy to rebase if needed.

@addyosmani

Copy link
Copy Markdown
Owner

This is a ~2700-line hooks PR from April and the hooks have changed substantially since. Closing as stale. A focused version against current main would be much easier to review if you want to revisit it.

@addyosmani addyosmani closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants