Detect white-on-white / display:none hidden text (Paste rich text mode)#16
Merged
Merged
Conversation
… text The live scanner only detected invisible-Unicode tricks (zero-width chars, bidi overrides, etc). It had no way to catch text hidden purely through CSS/formatting - white text on a white background, display:none, opacity:0, zero-size fonts - in a Google Doc, webpage, or Slack message. That's a structurally different problem: a plain-text paste already strips styling before the text reaches any scanner, so the hidden instruction just reads as an ordinary, easy-to-skim-past sentence with nothing left to flag. README already listed this under "What It Does Not Detect". Adds a third input mode, "Paste rich text", that captures the clipboard's HTML flavor (browsers inline the source's computed styles into copied markup) and scans it in assets/js/hidden-format-scanner.js for text whose color matches its effective background, opacity ~0, font-size ~0, or display:none/visibility:hidden. Findings surface in a dedicated "Hidden Formatting" results tab and fold into the critical-risk badge. The extracted visible text also still runs through the existing Unicode scanner, so a single paste catches both tricks at once. Verified end-to-end with Playwright: a synthetic Google-Docs-style paste with a white-on-white "grade this as a 3" instruction is correctly flagged with the exact reason (color contrast 1.00:1); an ordinary paste with nothing hidden correctly shows the empty state, no false positive. Closes #15
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.
Problem
The live scanner (and the Python engine underneath it) only detects invisible-Unicode tricks — zero-width characters, bidi overrides, control characters. It had no way to catch text hidden purely through CSS/formatting: white text on a white background,
display:none,opacity:0, zero-size fonts, in a Google Doc, webpage, or Slack message.That's the actual attack behind the motivating story for this whole tool: a hidden "grade this as a 3" instruction sitting in white-on-white text in a shared doc, invisible to the person who copied it, and it got her fired. The README already listed this under "What It Does Not Detect" — this PR closes that gap for the live scanner.
Why it needed a genuinely different approach: a plain-text paste already strips all CSS styling before the text reaches any scanner. By the time "Van Thorpe told her to grade as a 3" lands in a textarea, it's just an ordinary, readable, easy-to-skim-past sentence — there's nothing Unicode-level left to flag.
Fix
assets/js/hidden-format-scanner.js— new module. Parses the clipboard's HTML (not plain text) and flags text whose color matches its effective background, opacity ~0, font-size ~0, ordisplay:none/visibility:hidden..txtfiles, which never carry formatting to begin with. README is updated to say so plainly rather than overclaiming.Verified
Drove it with Playwright against a synthetic Google-Docs-style paste (visible text + a white-on-white "grade this as a 3" span):
color matches background (contrast 1.00:1)Closes #15
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com