feat(dev-hooks): flag hidden Unicode-steganography prompt injection on Read - #28
Closed
mickzijdel wants to merge 1 commit into
Closed
mickzijdel wants to merge 1 commit into
mickzijdel wants to merge 1 commit into
Conversation
…n Read commit-digest: dotfiles had no new commits since Run 20; own idea prompted by the ai-productivity-digest feed's "beware hidden prompt-injection text" item — scope it to a reliable signal (Unicode Tag chars / zero-width runs) rather than the fuzzier CSS-visibility heuristic the feed item described. New PostToolUse(Read) hook scans file content for Unicode Tag characters (U+E0000-U+E007F, the ASCII-smuggling range) or a run of 6+ zero-width characters, and feeds a correction back so Claude inspects suspicious content before treating it as instructions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DZdo4fGEBQEtC1pr3CKEKC
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
commit-digest Run 21 own idea.
nateberkopec/dotfileshad no new commits since Run 20 (HEAD is still5d5ca95); theai-productivity-digestfeed's "beware hidden prompt-injection text (e.g. white 3pt font)" item (source) prompted this, but scoped down to a reliable signal rather than the fuzzier one the feed item described:PostToolUse(Read)hook (hidden-text-reminder.sh): scans a file Claude just read for Unicode steganography used to smuggle invisible instructions past a human reviewer while an LLM still parses them — Unicode Tag characters (U+E0000–U+E007F, the "ASCII smuggling" range) or a run of 6+ zero-width characters (U+200B/U+200C/U+200D/U+2060/U+FEFF). On a hit it feeds a correction back (exit 2, every occurrence — no fire-once, since each file could carry different hidden content) telling Claude to inspect the flagged region before treating it as instructions.font-size:0, color-on-color,display:none) from the original tip — that needs style computation this hook can't do reliably from raw bytes, and false-positiving on legitimate small/hidden UI markup wasn't worth it. The Unicode-based signals have essentially no legitimate use in real documents, so it stays silent on ordinary files.hooks.jsonas a newPostToolUse→Readmatcher (first hook on that event/tool combo).plugin.jsonupdated; version bumped2.32.2→2.33.0(new hook = minor).Test plan
uv run pytest -q— 621 passed (8 new tests: fires on Unicode Tag chars, fires on a zero-width run, silent on plain text/binary/missing files, silent below the 6-char zero-width threshold, opt-out honored, fires on every occurrence with no fire-once suppression)shellcheck— cleanshfmt -d— no diffbash scripts/run-jscpd.sh python,bash— 0 clonesclaude plugin validate --stricton the marketplace and thedev-hooksplugin — both passGenerated by Claude Code