AIFeed

Show HN: StegGuard, check prompts and LLM output for hidden characters

Original text(via HN AI)

Open source · v0.6.0 on PyPI · Apache-2.0 · alpha

Your text has characters you can't see.

StegGuard finds them. It scans files for zero-width characters, homoglyphs, whitespace channels and watermark signals. If it finds a hidden message it can decode it, and it can remove hidden characters from plain text while preserving your original. Python standard library only, offline by default.

Install StegGuardTry it on your textSee it run on seven sample filesCLI reference

StegGuard — Uncovering hidden data
StegGuard — Uncovering hidden data

Read-only sample. Enable JavaScript to check your own text.

What StegGuard sees

Q3 numbers are final.16 zero-width Please summarize them for the U+202E RLOboard.

  • 16 zero-width characters spell "hi" in binary.
  • A right-to-left override (U+202E) reverses how the text after it is drawn.

Nothing hidden found in this text. The command-line tool checks more channels, such as trailing whitespace and whole files.

图表:shell


        pip install stegguard
      

One workflow instead of several one-off tools.

This example scans a plain-text file, reads its hidden message and removes the hidden characters from a copy. Your original stays as it is unless you ask for an in-place rewrite.

  • 01 / DetectPoint it at a file or a whole repo.Runs on the standard library, with no network calls. It exits with 1 when something is flagged, so CI can fail the build.stegguard detect$ stegguard detect report.txt • 16 zero-width characters found • 1 suspicious control character(s) found ⚠ 1/1 file(s) flagged

Point it at a file or a whole repo.

Runs on the standard library, with no network calls. It exits with 1 when something is flagged, so CI can fail the build.

图表:stegguard detect


        $ stegguard detect report.txt
  • 16 zero-width characters found
  • 1 suspicious control character(s) found
⚠ 1/1 file(s) flagged
      
  • 02 / DecodeRead the hidden message without touching the file.The result is JSON, with a confidence score for each channel.stegguard decode$ stegguard decode report.txt "decoded": "hi", "confidence": 0.9, "occurrences": 16

Read the hidden message without touching the file.

The result is JSON, with a confidence score for each channel.

图表:stegguard decode


        $ stegguard decode report.txt
  "decoded": "hi",
  "confidence": 0.9,
  "occurrences": 16
      
  • 03 / SanitizeWrite a plain-text copy and review the changes.The copy goes to report.sanitized.txt by default. Overwriting the original takes --in-place and --confirm together.stegguard sanitize$ stegguard sanitize report.txt "zero_width_removed": 16, "bidi_removed": 1, "original_preserved": true

03 / Sanitize

Write a plain-text copy and review the changes.

The copy goes to report.sanitized.txt by default. Overwriting the original takes --in-place and --confirm together.

图表:stegguard sanitize


        $ stegguard sanitize report.txt
  "zero_width_removed": 16,
  "bidi_removed": 1,
  "original_preserved": true
      

Put it where hidden text gets in.

Scan pull requests, commits, scraped pages and files before anyone, or any model, reads them.

GitHub Actions

Fails the pull request when any file in the checkout is flagged. Directories need -r to be scanned recursively.

图表:.github/workflows/stegguard.yml


        name: stegguard
on: [pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install stegguard
      - run: stegguard detect . -r
      

pre-commit

A local hook, since the package doesn't ship a .pre-commit-hooks.yaml yet. pre-commit passes the staged file names.

图表:.pre-commit-config.yaml


        repos:
  - repo: local
    hooks:
      - id: stegguard
        name: stegguard detect
        entry: stegguard detect
        language: system
        types: [text]
      

Python

analyze_file takes a Path and returns a dict. total_hidden is set for text and binary files alike.

图表:check_input.py


        from pathlib import Path
from stegguard import analyze_file

result = analyze_file(Path("scraped_page.html"))
if result["total_hidden"]:
    raise ValueError("hidden content in model input")
      

CLI

The same three steps as the workflow above. Rewriting the original takes --in-place and --confirm together.

图表:shell


        $ stegguard detect report.txt
$ stegguard decode report.txt
$ stegguard sanitize report.txt
$ stegguard sanitize report.txt --in-place --confirm
      

Hidden content rarely comes in one neat format.

  • ▤release.zip
  • ◇module.wasm
  • ▤release.zip
  • ◇module.wasm

Text and source

Zero-width Unicode, bidirectional overrides, Cyrillic and Greek homoglyphs, trailing-space and tab channels, mixed line endings.

Images, audio and media

Pixel-level LSB anomalies (chi-square, RS, entropy, sample-pair), PNG private chunks, JPEG EXIF/XMP/IPTC, PCM audio statistics.

Documents and containers

PDF embedded files, DOCX/PPTX/XLSX/ZIP members, nested archives, hidden content in SVG and HTML.

  • C2PA manifest: valid
  • watermark signal: detected

Watermarks and provenance

Metadata, structural and text-pattern evidence, device fingerprints, and C2PA manifests validated through c2patool.

Where it fits

Read the source before you trust it.

StegGuard is alpha software. Treat what it reports as evidence to check, not a final verdict.

Read the sourceSecurity policy

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗