Repository navigation
release(v1.0.1): escape document values and field names, mitigate CVE-2024-4367 #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
23b7a9a
fix(422): escape field names in the HTML field performance table
harrycav 5904cf2
fix(422): str() the field name, test the chart's escaping, truncate b…
harrycav 0fe46d7
fix(431): keep document data from ending the report's <script> block
harrycav 3d1411a
test(431): guard the field-threshold blob with a schema-derived field…
harrycav bccff43
fix(report): accept a non-string document identifier
digalaviz 810bace
fix(report): escape the confusion counts in the field performance table
digalaviz b07190c
docs: say what the U+2028/U+2029 entries actually do
digalaviz 1959b2f
chore(deps): bump mkdocs-material to 9.7.7 (GHSA-xvg9-69gf-fjrf)
digalaviz 09b6afe
chore: bump version to 1.0.1 for release
digalaviz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
chore: bump version to 1.0.1 for release
Adds the [1.0.1] CHANGELOG section with both link definitions, and bumps pyproject.toml, src/stickler/__init__.py and uv.lock together.
- Loading branch information
commit 09b6afefce3367e852d9e946461936d11eaa537f
There are no files selected for viewing
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocker. A third-party PDF can still run script in a 1.0.1 report, so this headline does not hold for every document input.
The report loads pdf.js 3.11.174 from cdnjs (
html_reporter.py:244and:247), andloadPDFcallspdfjsLib.getDocument(url)with default options (interactive/main.js:538). That version is affected by CVE-2024-4367 (GHSA-wgrm-67xf-hhpq). With the defaultisEvalSupported: true, a crafted font in a PDF runs JavaScript in the page's origin. Every release from 0.1.3 through this branch loads the same pdf.js version with the same call.Reproduced at this PR's head (09b6afe):
generate_report(..., document_files={"invoice-001": "<crafted>.pdf"}, individual_results_jsonl_path=...)with the defaultReportConfig.invoice-001in the Report View dropdown makesupdateDocumentFileschoose the PDF renderer from the file extension (main.js:401), and the payload runs in headless Chrome.--allow-file-access-from-files. Opened fromfile://in Chrome with default settings, the fetch fails withMissingPDFException, so neither the viewer nor the payload runs.src/stickler/reporting/html/README.md:123-138tells users to runpython -m http.server 8080(line 130), because "PDF features work only when served via HTTP" (line 138).Lines 40-44 give "do not open a report built from untrusted document data" as a precaution for users who cannot upgrade. That reads as: the precaution is unnecessary on 1.0.1. For PDFs it is still necessary.
Change requested, one of:
interactive/main.js:538, callpdfjsLib.getDocument({ url, isEvalSupported: false }). With only that change, the same PDF still renders ("Page 1 of 1") and the payload does not run. The complete fix is pdf.js 4.2.67 or later, vendored or pinned with anintegrity=hash.document_filesare not covered, and add "do not pass untrusted PDFs indocument_files" to the advice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is applied verbatim:
pdfjsLib.getDocument({ url, isEvalSupported: false }), insideconst loadPDF = (url, canvasId, loadingId, errorId), so the property shorthand resolves as youwrote it.
The finding, the reproduction and the headless-Chrome measurement are yours.
Verification boundary. What was measured here is that the option reaches the generated page, and
that reverting the call to
getDocument(url)turns exactly one test red. The browser-level result —that the same PDF renders while the payload does not run — is yours; it was not reproduced here,
because this side has no browser harness. If you want that half re-confirmed against the branch
rather than against your original run, it needs your setup.
Residual: this release applies the upstream-documented option-level mitigation only. It does not
upgrade the pdf.js dependency, and dependency loading and pinning are unchanged. Both are tracked
for the next release and are out of scope for this patch.
One narrowing worth having in the text:
main.jsis embedded only when individual results areloaded, so this route required both
document_filesandindividual_results_jsonl_path. Notpassing the JSONL path therefore closed this route and the
<script>blob route together. Easiestway to see it: generate a report with
document_filesand no JSONL path, and look forgetDocumentin the output. That narrowing is in the changelog on this branch, in the"Affected versions" paragraph.
Advisory: the severity and vector are being settled on the advisory draft rather than here,
including how to characterise the dependency route this release mitigates but does not upgrade. No
action is needed on this comment.
Request: confirm the line was applied as you measured it.