fix(deps): bump pdf-extract 0.10→0.12 to patch lopdf RUSTSEC-2026-0187#6339
Merged
Conversation
A new high-severity advisory (RUSTSEC-2026-0187, CVSS 7.5, published 2026-06-21) reports a stack overflow in lopdf when parsing deeply nested PDF objects. lopdf reaches us transitively through pdf-extract 0.10.0 — a direct dependency of librefang-channels and librefang-runtime — which pins lopdf ^0.38, so the fixed lopdf >=0.42.0 is unreachable without bumping pdf-extract itself. The path is attacker-reachable: both crates feed user-supplied PDF attachment bytes straight into pdf_extract::extract_text_from_mem (crates/librefang-channels/src/attachment_enrich.rs, crates/librefang-runtime/src/pdf_text.rs), so a crafted PDF can drive the overflow. The existing catch_unwind guards at those sites do NOT mitigate it — a stack overflow aborts the process rather than unwinding, so catch_unwind never runs. The dependency upgrade is the actual fix. pdf-extract 0.12.0 (published 2026-06-25) requires lopdf ^0.42, so bumping the requirement in both crates and regenerating Cargo.lock pulls the patched lopdf 0.42.0 (also pdf-extract 0.10.0→0.12.0, cff-parser 0.1→0.2; drops bytecount/nom_locate). The only public API used — extract_text_from_mem — is unchanged across the bump. Without this, the Security CI job (cargo audit) fails repo-wide on every PR with exit 1: the advisory is not in the ci.yml --ignore allowlist, and it should be patched rather than ignored because a fixed release exists.
houko
enabled auto-merge (squash)
June 26, 2026 11:42
This was referenced Jun 29, 2026
Merged
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.
Problem
A new high-severity advisory — RUSTSEC-2026-0187 (CVSS 7.5, published 2026-06-21) — reports a stack overflow in
lopdfwhen parsing deeply nested PDF objects.lopdf 0.38.0reaches us transitively throughpdf-extract 0.10.0, a direct dependency oflibrefang-channelsandlibrefang-runtime.pdf-extract 0.10pinslopdf ^0.38, so the fixedlopdf >= 0.42.0is unreachable without bumpingpdf-extractitself.This made the
SecurityCI job (cargo audit) fail repo-wide on every PR (exit 1) — the advisory is not in theci.yml --ignoreallowlist. It is currently blocking #6338 (and would block any PR / the next release).Why it's attacker-reachable
Both crates feed user-supplied PDF attachment bytes straight into
pdf_extract::extract_text_from_mem:crates/librefang-channels/src/attachment_enrich.rscrates/librefang-runtime/src/pdf_text.rsA crafted PDF can drive the overflow. The existing
catch_unwindguards at both sites do not mitigate this: a stack overflow aborts the process rather than unwinding, socatch_unwindnever runs. The dependency upgrade is the real fix, not a defense-in-depth nicety.Fix
Bump
pdf-extract0.10→0.12in both crates and regenerateCargo.lock.pdf-extract 0.12.0(published 2026-06-25) requireslopdf ^0.42, pulling the patchedlopdf 0.42.0.Lockfile delta (minimal):
lopdf0.38.0 → 0.42.0 (the fix)pdf-extract0.10.0 → 0.12.0cff-parser0.1.0 → 0.2.0bytecount,nom_locate(no longer in the tree)The only
pdf-extractAPI used —extract_text_from_mem(&[u8]) -> Result<String, _>— is unchanged across the bump; both call sites already treat the error viaDisplay, so no source changes are needed.Changed files
crates/librefang-channels/Cargo.toml—pdf-extract = "0.12"crates/librefang-runtime/Cargo.toml—pdf-extract = "0.12"Cargo.lock— regenerated viacargo update -p pdf-extract --precise 0.12.0CHANGELOG.md—[Unreleased]→### FixedentryVerification
cargo auditno longer flags RUSTSEC-2026-0187 oncelopdf 0.42.0is in the lock (verify via theSecurityCI job on this PR going green).Test / Unit (lib+bin)+ build lanes) per the repo's "no local cargo build" rule; the API surface touched is a single unchanged function.Out-of-scope note (not touched here)
The existing
## [Unreleased]section inCHANGELOG.mdsits below the already-released## [2026.6.26]section and re-lists several PRs (#6312, #6315, #6316, #6330) that also appear under2026.6.26— a pre-existing release-tooling artifact, not introduced by this PR. Left as-is to keep this change scoped; flagging for a maintainer.