🔍 StegGuard: open-source tool finds invisible characters in text, files and prompts
In brief
- 🔍 StegGuard is a Python tool that scans files for hidden characters and watermark signals.
- 🧩 It looks for zero-width characters, bidi overrides, homoglyphs and whitespace channels, among others.
- ⚙️ Runs offline on the Python standard library; Apache-2.0, currently alpha (v0.6.0).
- 🔒 Meant for CI checks and for screening text before a model reads it.
StegGuard scans text files, images, audio, PDFs and office documents for hidden content: invisible zero-width characters, direction-reversing control characters, look-alike letters from other alphabets and more. It can decode a hidden message and strip hidden characters from plain text while leaving the original alone. According to the project page it runs offline, is open source (Apache-2.0) and is still alpha.
**Why you might want it.** Text that is copied, scraped or submitted in a pull request can carry things you cannot see. The project page shows an example: a sentence “Q3 numbers are final.” holds 16 zero-width characters that spell “hi” in binary, plus a right-to-left override (U+202E) that reverses how the following text is drawn. Such characters can mislead a code reviewer or, as prompt injection, slip instructions to a language model that a human never reads.
**What it checks.** Per the page, StegGuard covers several channels: zero-width Unicode, bidirectional overrides, Cyrillic and Greek homoglyphs, trailing-space and tab channels, mixed line endings; in images pixel-level least-significant-bit anomalies (chi-square, RS, entropy, sample-pair), private PNG chunks, JPEG EXIF/XMP/IPTC metadata and PCM audio statistics; in documents PDF embedded files, DOCX/PPTX/XLSX/ZIP members, nested archives, hidden content in SVG and HTML. It also gathers metadata, structural and text-pattern evidence, device fingerprints and C2PA manifests validated through c2patool.
**How it works.** The command line reads a hidden message without touching the file, prints JSON with a confidence score per channel and, on request, writes a sanitised plain-text copy (by default `report.sanitized.txt`). Overwriting the original needs `--in-place` and `--confirm` together. The program exits with code 1 when something is flagged, so a CI pipeline can fail the build; the page also describes a local pre-commit hook and a Python function `analyze_file`. It needs only the standard library (Pillow is optional for images), makes no network calls, and its tests run on every push, according to the page.
**Use cases the project lists.** A CI gate against BIDI overrides and homoglyphs in source files, checks of pasted text and scraped pages before they reach a model, scanning DOCX, PPTX and PDF before sending, and provenance audits with C2PA. The developer says plainly that StegGuard is alpha software and that a result is evidence to check, not a final verdict. Install from PyPI; page: [stegguard.com](https://stegguard.com).