Repository navigation
feat!: refuse the PDF features a scanned book never has - #8
Merged
Merged
Conversation
JavaScript, a form, attached files and a launch action are each a way for a document to make the viewer act rather than draw the page, and none of them belongs in a scan. The default policy now refuses all four, and `pdf_features` names the ones a policy will pass; `--pdf-features` does the same for the command. The verdict's facts carry what was found. JavaScript and forms are read from pdfinfo's report and attached files from pdfdetach's listing, so a feature inside a compressed object stream is still seen. A launch action is reported by no poppler tool, so it is found by its name in the file, the way pdfid finds it: a bounded scan of the bytes with the #xx escapes undone, which is a search and not a parser; AGENTS.md says so and says it must stay that way. Attached files and the scan are only looked for when the page count is within the limit, since a file over it is refused whatever else it carries. Breaking: a PDF that carries any of the four, which passed before, is refused by default. The hostile corpus gains a PDF for each, including the escaped spellings. Stage 2 of brief 022. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…es not report an open action's script CI's poppler, 24.02, says `JavaScript: no` for a script attached to the document's open action; 26.04 says yes. The report is still read, and the same bounded scan that finds a launch action now finds the names /JavaScript and /JS as well. The corpus gains a document-level script, which every poppler reports, and a test fakes the older report. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
pdf_features, naming which of JavaScript, forms, attached files and launch actions a PDF may carry. The default andSTRICTallow none: each is a way for a document to make the viewer act rather than draw the page, and a scanned book has none.--pdf-featuresdoes the same for the command, andFacts.featuressays what was found.pdfinfo's own report (JavaScript: yes,Form: AcroForm), attached files frompdfdetach -list, both of which see inside compressed object streams. A launch action is reported by no poppler tool, so it is found by its name in the bytes with#xxescapes undone, the waypdfiddoes it: a bounded search in 1 MiB chunks, not a parser.AGENTS.mdrecords that exception to the "no PDF code here" rule and that it must stay a search.PdfInfoMissingnow names whichever poppler tool is absent.Breaking: a PDF carrying any of the four passed before and is refused by default now, so this is a
feat!under the release rule. Stage 2 of brief 022.Test plan
#-escaped spellings of the JavaScript and Launch names; each refused with its sentence, each passed when the policy names it; a policy that allows some names them in the reason; a PDF over the page limit still reports what the summary showed/Launcherand/Launch2not matched, a name straddling a chunk boundarypdfdetachmissing is a configuration error naming the tooluv lock --check,zensical build --clean --strict🤖 Generated with Claude Code