Skip to content

feat(edit-pdf): secure redaction with fail-closed verify - #98

Open
nonamexishere wants to merge 5 commits into
McanKul:developmentfrom
nonamexishere:feat/10-secure-redaction
Open

feat(edit-pdf): secure redaction with fail-closed verify#98
nonamexishere wants to merge 5 commits into
McanKul:developmentfrom
nonamexishere:feat/10-secure-redaction

Conversation

@nonamexishere

Copy link
Copy Markdown
Contributor

Summary

Adds a distinct Redact tool in Edit PDF (not a black rectangle stamp). On Save, only pages with a redaction region are rasterized; fill/label are burned into the page image; leftover annotations, form values, and attachments are warned, not stripped. Verification fail-closes if source page-content probes remain. The original file is never overwritten.

Fixes #10.

How it works

  • New kind: "redact" object + canvas tool (separate from Rectangle).
  • Preview is a see-through hatch so you can see what you are covering. Save still burns a solid fill.
  • Affected pages: pdftoppm → paint fill/label on the bitmap → replace page contents with one image XObject. /Rotate pages rasterize a sibling with rotate forced to 0 so the fill lands on the covered words.
  • Missing pdftoppm fails closed (RENDERER_MISSING); no white-page fallback.
  • #34 validate_staged_pdf / qpdf --check still gates dest publish. Redacted pages get a rebuilt content digest.
  • Mixed jobs: unredacted pages keep selectable text. Verify probes only the redacted page’s original stream.

Test plan

  • npm test / npm run typecheck / cargo test --manifest-path src-tauri/Cargo.toml --lib
  • Edit PDF: Redact vs Rectangle are distinct in the toolbar and object list.
  • Draw a redaction over selectable text, Save to a new file. Output: covered text cannot be selected/searched. Original file unchanged.
  • Two-page PDF: redact page 1 only. Page 2 text still selects.
  • Rotated QA file (qa-rotate90-trim-inside-crop.pdf): black patch sits on the word you covered.
  • Form/notes leftover: warning on the job, values not auto-stripped.
  • Control: black Rectangle over the same word — text still selectable under the box.
  • Redact-tool banner appears only while Redact is selected; Output warning appears once a redaction exists.

…erify

Add a distinct redact object and tool in Edit PDF. Save rasterizes only
pages that have regions, burns fill/label into the page image, and
fail-closes if source page-content probes remain. Leftover annotations,
form values, and attachments are warned, not stripped.

Checkpoint before review-bug fixes: rotate fill mapping, missing
pdftoppm must not publish, and mixed-job verify probes.
Rasterize a /Rotate-zero sibling so fill lands on the covered words, fail
closed when pdftoppm is missing, and probe only the redacted page stream.
Preview uses a see-through hatch; the tradeoff banner shows only while
the Redact tool is selected.
Address PR McanKul#98 review: scale the raster/fill by /UserUnit, search
verify probes only on the redacted page, flatten widgets/annots before
the burn, and ignore objectRotate on redact objects.
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.

1 participant