返回资讯中心
外部精选
软件工程
#开发者实时流

StegGuard 开源工具上线,可检测提示词和 LLM 输出中的隐藏字符

来源标题:Show HN: StegGuard, check prompts and LLM output for hidden characters

开源工具 StegGuard v0.6.0 已发布到 PyPI,采用 Apache-2.0 许可。它能扫描文件中的零宽字符、同形字、空白信道和水印信号,发现隐藏信息后可解码,并能在保留原文的前提下清除隐藏字符。该工具仅依赖 Python 标准库、默认离线运行,检测到问题时以退出码 1 结束,便于 CI 拦截构建。

Hacker News 最新humblejedi2026/11/25 · 今天10 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

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

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

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

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

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

pip install stegguard

01 / How it worksOne 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.

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 report.txt • 16 zero-width characters found • 1 suspicious control character(s) found ⚠ 1/1 file(s) flagged

02 / Decode

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

$ stegguard decode report.txt "decoded": "hi", "confidence": 0.9, "occurrences": 16

03 / Sanitize

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

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

02 / IntegrationsPut it where hidden text gets in.

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

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

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.

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.

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.

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

03 / CoverageHidden content rarely comes in one neat format.

Files StegGuard can scanPause motion≡build.log

▧logo.png

¶report.pdf

⌘Dockerfile

♫voice.wav

▤release.zip

{}app.ts

▷clip.mp4

◇module.wasm

≡build.log

▧logo.png

¶report.pdf

⌘Dockerfile

♫voice.wav

▤release.zip

{}app.ts

▷clip.mp4

◇module.wasm

View format support ↗pаypal.com

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

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

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

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

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

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →