◉CLAUDE LABJP
●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…
Articles/Claude Code
⟐ Claude Code/2026-07-17Advanced

The String I Approved Wasn't the String I Read — Testing a Relayed Permission Prompt with Deceptive Characters

I pushed bidi overrides and zero-width characters through my own approval relay. NFKC normalization caught 0%. Here is why, and the implementation that catches 100% with zero false positives.

Claude Code264Permissions7Security12UnicodeAutomation45

✦ Premium Article

Once I moved my nightly updates to unattended runs, the only thing left in my hands was the approval.

The four sites I run at Dolice Labs go from article generation through quality gates to push without me. When something risky comes up, a permission prompt lands in my chat, and I read it and let it through. More than once I've approved a single line while standing on a train platform.

A recent Claude Code update carried a short note: permission previews relayed to chat channels now neutralize bidirectional override characters, zero-width characters, and lookalike quotation marks. The point of the fix is that tool input shouldn't be able to change how an approval message looks.

That stopped me.

If the look can be changed, then what I had been approving all along was never the string that runs. It was the appearance of the string that runs. Those two things usually match. I had no particular reason to believe they always would.

So I pushed deceptive strings through my own relay, and the results weren't what I expected.

Where the deception comes from

The gap between how a string looks and what it contains exists because Unicode carries characters that are instructions for display. The layer that renders obeys them. The layer that executes ignores them and reads bytes. That asymmetry is the whole opening.

TrickCode pointWhat happens
Bidi override (RLO)U+202EEverything after it renders right-to-left, so the tail appears reversed
Zero-width spaceU+200BOccupies no width and hides inside a word. Your eyes miss it; so does your regex
Zero-width non-joinerU+200CSame idea. Slip one inside a flag name and it becomes a different flag
Lookalike quotesU+201C / U+201DLooks quoted. To the shell, it's just a character
HomoglyphU+043F, etc.Cyrillic п passing as Latin n. A different identifier entirely
NewlineU+000ALets an attacker add fake lines to the preview — including one that says "approved"

That last row is the one that got me. The goal of the deception isn't only to make a dangerous command look safe. It also works by making the person reading believe someone already checked. The target isn't the terminal. It's me, reading the screen.

The upstream fix protects the upstream screen

It's worth being precise about where the trust boundary sits.

The fix on the Claude Code side sanitizes the permission preview that Claude Code assembles. That's the right fix, and it holds as long as you use the default path.

My setup steps outside it. I consume unattended runs as stream-json, format the requests that need confirmation with my own bot, and relay them to chat. The formatting is my code. So a string that was sanitized upstream gets handed back to me and re-rendered by my renderer. The upstream fix cannot reach inside my renderer.

SegmentWho protects itState in my setup
Tool input → Claude Code previewClaude Code (fixed)✅ Protected
stream-json → my bot's formattingMe⚠️ Passed through raw
Bot → chat renderingThe chat client⚠️ Left to the client
Approval → actual executionMe⚠️ Never verified

Prompt injection defense — scrubbing what you feed the model — is a well-worn topic. That protects the model. What's at stake here runs the other direction: the channel from the model to the human. In my setup, nobody owned the job of protecting the approver.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Measured results across four layers: plain relay 0%, control-char stripping 50%, NFKC normalization 0%, escaped rendering 100%
✦A naive non-ASCII rule blocks 40% of my real commit messages. A script allowlist gets 0% false positives at 100% detection
✦A working approval-token implementation that separates what you display from what you verify
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-09-05
My deny rule was watching a filename, not the routes that reach it
One line in deny let several other spellings of the same file walk right past. Here is the small matrix I build to list every route to a protected file, and how I re-check it on upgrade day.
⟐ Claude Code2026-07-25
Locking down Claude Code sandbox egress with strictAllowlist
Tightening automation egress with strictAllowlist in Claude Code v2.1.219, plus measured failure timings that tell a policy deny from DNS and real outages, and three defects that made my own recon scripts return nothing.
⟐ Claude Code2026-10-13
The Same Approval Prompt for 'cd, git add, git commit' Every Time — Following It to a Design Choice, Not a Missing Setting
With a compound command like cd /path && git add && git commit, Claude Code keeps asking for approval even with allow rules in place. Reading the official permissions page next to a GitHub report shows that cd combined with git prompts by design. Here is how to tell, in what order to check, and four ways to cut the prompts.