Repository navigation
test(report): harden #464's report tests, and record the #457 slowdown - #465
Merged
sromoam merged 4 commits intoOct 30, 2026
Merged
Conversation
… and its pdf.js Three tests in a new test_pdf_viewer.py, alongside the existing test_the_pdf_viewer_disables_eval: - the page has exactly one pdfjsLib.getDocument(...) call and it carries isEvalSupported: false. A check for the safe form alone still passes when a second loader is added without the option, e.g. getDocument(u); - the viewer is not embedded without individual_results_jsonl_path; - the pdf.js <script> tag still loads 3.11.174 and has no integrity hash, so the upgrade is a deliberate change. Its failure messages say to invert the integrity assertion then, not delete it.
Nine tests on _load_individual_results: zero, float and NaN ids become strings; a string id, None and a missing key are left alone; a line that is not an object does not drop the records after it; ids that differ only by type now map to the same string; and every id embedded by generate_report is a string, including one above 2**53. Several guard against a mis-fix rather than the fix: dropping the dict guard, converting None, testing the id for truthiness, or converting only int each pass the existing tests.
…he prediction The fixture gave prediction_value the value 'short', so only the ground-truth column could tell truncate-then-escape from escape-then-truncate. Both columns now carry 97 characters and an ampersand, and both are asserted.
…labs#457 Reports generated with individual_results_jsonl_path take longer to write since the script-block escaping: 467 ms against 42 ms at 1.0.0 for 1,000 documents, per awslabs#457. Evaluation results are unaffected.
Security Scan ResultsASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Top 3 HotspotsFiles with the highest number of security findings:
Detailed FindingsShow 5 actionable findingsFinding 1: SECRET-HEX-HIGH-ENTROPY-STRING
Description: Code Snippet: Finding 2: B108
Description: Code Snippet: Finding 3: B307
Description: Code Snippet: Finding 4: B307
Description: Code Snippet: Finding 5: B102
Description: Code Snippet: Report generated by Automated Security Helper (ASH) at 2026-10-29T21:47:47+00:00 |
sromoam
merged commit Oct 30, 2026
01f6fff
into
awslabs:fix/report-hardening-from-452
9 checks passed
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.
@sromoam, this has the parts of the #452 recut that #464 doesn't cover yet. I've opened it as a PR
against your branch rather than pushing onto it, so you can take or drop each commit. It's tests
and one CHANGELOG entry; nothing under
src/changes.test_html_reporter.pyis untouched, and theonly existing test it edits is the truncation test in
test_section_generator.py, which predates #464. Therecut's code and #464's do the same thing: the recut's tests pass unchanged against #464's
getDocumentcall anddoc_idloader.6af633ftest(report): pin the PDF viewer's only loader call, its reachability and itspdf.js. Adds
test_pdf_viewer.pywith three tests, which sit next totest_the_pdf_viewer_disables_eval:pdfjsLib.getDocument(...)call, and that call disables eval.individual_results_jsonl_path.<script>tag still loads 3.11.174 and has nointegrityhash. When the upgradelands, the failure messages say to invert the
integrityassertion, not delete it.0b694bdtest(report): cover the doc_id conversion's edge cases. Nine tests on_load_individual_results:Noneand a missing key are left as they are.generate_reportembeds is a string, including one above 2**53.c24055ctest(report): let the truncation test catch escape-then-truncate on theprediction. The fixture gave
prediction_valuethe value'short', so only one column couldtell the two orders apart. Now both can.
9fd99e2docs(changelog): record the report-generation slowdown tracked in perf(report): _json_for_script is ~10x slower than json.dumps since 1.0.1 #457. This is theline you asked for on release(v1.0.1): escape document values and field names, mitigate CVE-2024-4367 #452, which fix(report): carry the #452 report hardening onto dev, and mitigate CVE-2024-4367 #464's CHANGELOG doesn't have yet. It's under
[Unreleased]→### Performance, following the[1.0.0]precedent, and is scoped toindividual_results_jsonl_pathusing perf(report): _json_for_script is ~10x slower than json.dumps since 1.0.1 #457's figures.What the tests add. None of these is a bug in #464; your code passes all of them. They're
mistakes a future edit could make that the existing tests would let through. I applied each one to
#464's head in a scratch copy and ran
tests/reporting/htmltwice: once with #464's tests only, andonce with these added.
pdfjsLib.getDocument(u)pdfjsLib.getDocument( url )doc_id: the dict guard droppeddoc_id:Noneconverted toodoc_id: tested for truthiness, so0stays a numberdoc_id: onlyintconvertedA comment that mentions
pdfjsLib.getDocument()doesn't trip the count.Full suite on this branch after a plain
uv sync --frozen, withsticklerimported from it:3986 passed, 13 skipped, 1 xfailed. #464 reports 3974 passed; the 12 extra are the tests added
here.
ruff check src tests,docs/check_links.pyanduv lock --checkare clean.None of these tests runs a browser. The browser-level result is still vawsgit's headless-Chrome
measurement from #452.