Skip to content

Detect white-on-white / display:none hidden text (Paste rich text mode)#16

Merged
DaCameraGirl merged 1 commit into
mainfrom
feature/hidden-formatting-scanner
Jul 5, 2026
Merged

Detect white-on-white / display:none hidden text (Paste rich text mode)#16
DaCameraGirl merged 1 commit into
mainfrom
feature/hidden-formatting-scanner

Conversation

@DaCameraGirl

Copy link
Copy Markdown
Owner

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, or display:none/visibility:hidden.
  • New "Paste rich text" input mode in the live scanner: copy directly from the source (Ctrl+C) and paste (Ctrl+V) into a contenteditable box. Browsers preserve the source's styles in the clipboard's HTML flavor, which is exactly what this needs.
  • Findings show in a new "Hidden Formatting" results tab and fold into the critical-risk badge. The visible text extracted from the paste also still runs through the existing Unicode scanner, so one paste catches both tricks.
  • This is a live-scanner-only capability for now — the CLI/desktop app work from saved .txt files, 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):

  • Correctly flagged with reason color matches background (contrast 1.00:1)
  • Auto-switched to the Hidden Formatting tab, critical badge shows the finding
  • A control paste with nothing hidden correctly shows the empty state — no false positive
  • Zero console errors

Closes #15

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

… 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
@DaCameraGirl DaCameraGirl merged commit ecaddad into main Jul 5, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect CSS-hidden text (white-on-white, display:none, opacity:0)

1 participant