fix: harden Python hooks (injection, logging, audit)#5
Open
riaworks wants to merge 1 commit intothiagofinch:mainfrom
Open
fix: harden Python hooks (injection, logging, audit)#5riaworks wants to merge 1 commit intothiagofinch:mainfrom
riaworks wants to merge 1 commit intothiagofinch:mainfrom
Conversation
- notification_system.py: Escape backslashes and double quotes in AppleScript strings to prevent command injection via notification title/message (M-03) - continuous_save.py: Reduce log truncation from 2000/500 to 200 chars, log only safe metadata keys from tool inputs instead of full content to prevent sensitive data leakage in session logs (M-07) - memory_updater.py: Add audit_file_modification() that logs all file changes to logs/memory-audit.jsonl with timestamp, file path, modification type, and diff summary (M-10) - gsd-check-update.js: Replace execSync with execFileSync (no shell), add error handling for cache writes, document as only hook with network access (L-11) Findings addressed: M-03, M-07, M-10, L-07 (already covered), L-11 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
notification_system.py— added_escape_applescript()to sanitize\and"before interpolationcontinuous_save.py— truncate from 2000/500 to 200 chars, log only safe metadata keysmemory_updater.py—audit_file_modification()writes tologs/memory-audit.jsonl.gitignore(__pycache__/+*.py[cod]) — no tracked.pycfiles foundexecSyncwithexecFileSyncingsd-check-update.js— no shell invocation, added error handlingFiles Changed
.claude/hooks/notification_system.py.claude/hooks/continuous_save.py.claude/hooks/memory_updater.py.claude/hooks/gsd-check-update.jsSecurity Frameworks
Test Plan
notification_system.pyhandles"and\in title/message without AppleScript breakoutcontinuous_save.pylogs max 200 chars per field, only metadata keys for tool_usememory_updater.pywrites audit entries tologs/memory-audit.jsonlon file modificationgsd-check-update.jsusesexecFileSync(no shell), handles npm/cache errors gracefully🤖 Generated with Claude Code