Files
pdfcraft/crates
NetterSilver 5aae9dbae2 Keep the part of an email address before an apostrophe when redacting
## What this changes

Email redaction no longer drops the part of an address before an apostrophe. The email scanner's `local` closure in `crates/redact/src/patterns.rs` did not accept an apostrophe in the local part. It treated `'` as a boundary and started the match after it, so for `o'brien@example.com` only `brien@example.com` matched. Search and Redact share that span, so the leading `o'` stayed visible.

The local part may now contain an apostrophe, but a match cannot start on one. `o'brien@example.com` and `'john'@example.com` are now matched as `o'brien@example.com` and `john'@example.com`. A quote around an address (`'john@example.com'`) stays outside the match.

No linked issue. Found while testing `crates/redact/src/patterns.rs:216` (email, `local` closure).

## How you verified it

- [ ] `cargo fmt --check`
- [ ] clippy with `-D warnings` on the crates I changed
- [x] tests pass on the crates I changed
- [ ] `cargo xtask layers` and `cargo xtask assets` (if you touched crate boundaries or any asset)

- Regression test `patterns::tests::email_local_part_may_contain_an_apostrophe` covers all three cases. It fails on `main` without the fix and passes with it (`cargo test -p pdfcraft-redact email_local_part_may_contain_an_apostrophe`).
- `cargo xtask ci` passes.

## Never-crash

- [ ] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why
- [ ] No indexing or slicing with input-derived positions (`get`, and strings only at char boundaries); checked or saturating arithmetic; allocations sized by input are capped; recursion is bounded
- [ ] No `unsafe`
- [ ] Any crash this fixes has a small synthetic regression test

## Provenance

- [ ] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated
- [ ] No font files committed here (they live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts))
- [ ] No GPL/AGPL code copied in (MuPDF, Ghostscript, Poppler, veraPDF and DSS may only be run as external oracle processes)
- [ ] Behaviour comes from the specification or black-box observation, not from reading another implementation's source
- [ ] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes

## Security

- [ ] `--root` confinement still holds on every path, including ones reached by nested tool dispatch
- [ ] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated
- [ ] No new outbound network access

## Parity and reach

- [ ] `parity/acrobat-features.toml` updated in this PR, with `notes` saying what is still missing
- [ ] Reachable headlessly through an `automation` tool where that applies, so agents can drive it and not just the UI
- [ ] Docs updated if this changes a documented behaviour (`docs/`, crate README)

## Anything a reviewer should look at first

- A quote right before the local part, as in `'john'@example.com`, stays outside the match, so that leading quote stays visible after Redact. Matching it would also pick up the quote around quoted addresses. This is a deliberate restraint.
- The domain scan and the other patterns are unchanged.

🤖 Generated with AI by [ApolloOffice](https://github.com/Silvertree2010/ApolloOffice), see the Co-Authored-By trailers for the models
2026-11-18 16:32:21 +07:00
..
…
…
…
…