fix(detect): Fix cross-hatch false positives and filter control chars#216
Open
mlissner wants to merge 3 commits into
Open
fix(detect): Fix cross-hatch false positives and filter control chars#216mlissner wants to merge 3 commits into
mlissner wants to merge 3 commits into
Conversation
Two fixes for garbled font encoding false positives: 1. Add minimum 4pt width/height to _is_x_hatch_drawing. Thin vertical margin lines (0.75pt wide) were passing the line-pair check and being treated as cross-hatch redactions. 2. Filter text containing non-whitespace control characters (< 0x20, excluding tab/newline/return). These indicate garbled font encoding that happened to avoid U+FFFD. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that thin vertical margin lines (~0.75pt) aren't mistaken for cross-hatched redactions, and that garbled text with control characters is filtered. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extracts specific pages with compression. Supports comma-separated page numbers and ranges (e.g., --pages 0,5,10-15). Useful when source PDFs exceed the 5MB pre-commit file size limit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
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.
Summary
Fixes for false positives from garbled font encoding in this PDF, plus a new developer tool:
Cross-hatch minimum size — add 4pt width/height check to
_is_x_hatch_drawing. Thin vertical margin lines (0.75pt wide) were passing the line-pair check and matching text on the page as "cross-hatched redactions."Control character filter — filter text containing non-whitespace control characters (
\x11,\x13, etc.) infilter_redactions_by_text. Real text never contains these — they indicate garbled font encoding that happened to avoid the U+FFFD replacement character.tools/trim-pdf.py— new tool to extract specific pages from large PDFs with compression, for creating test assets that stay under the 5MB pre-commit limit. Supports comma-separated pages and ranges (e.g.,--pages 0,5,10-15).Test plan
test_thin_margin_lines_not_cross_hatchesverifies both fixes with real-world PDFbad_cross_hatched_redactions.pdf(16 redactions)🤖 Generated with Claude Code