Repository navigation
make-pdf blocks javascript: links written with tabs or entity letters, plus four small fixes (GST-3641) - #4848
Merged
Conversation
…n answer; multi-line timeline events stay readable Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… and wide SVGs are measured by width, not stroke-width Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…entity letters Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/red-team#1 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#3 reader=outside-voice Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… checked too Review-Finding: p3/red-team#1 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.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.
make-pdf now removes
javascript:links in untrusted Markdown even when the scheme is split by a tab or line break or written with entity letters, and it fixes curly quotes at the start of a paragraph, SVG sizing, one learnings crash and one lost timeline event.Why: these spellings still produced live links in the HTML make-pdf prints, and the other four bugs were verified on main by an independent check.
Nothing for readers to do; ordinary Markdown prints the same apart from opening quotes, which now curl the right way.
What changed
href,src,action,formaction,xlink:href) is decoded the way the browser decodes it, with tabs and line breaks removed. If it still starts withjavascript:, a#goes in front, which makes the whole value a harmless fragment. The existing rules are unchanged, so this only adds catches. A click handler whose quoted value contains>is now removed with its value when it starts an attribute of its tag; inside another attribute's value only its name goes, as before. A numeric reference such asΫthat only starts like a colon no longer rewrites an ordinary link.<em>are read through, and images, code and unknown tags count as a word, so--flagand the quotes after a placeholder stay as they were.stroke-widthanddata-heightare no longer read as the width or height, so a wide diagram moves to a sideways page again.filesis a string or whosetsis a number no longer breaks every later search; the log stores a single path as a list; another project's learning never replaces this project's own.tsno longer stopsgstack-timeline-read.Why
make-pdf prints Markdown that often comes from somewhere else, and its print browser runs page scripts, so a
javascript:link that survives the sanitizer is live. The other four fixes are bugs an independent check reproduced on main. They caused wrong quote direction in most documents that open with a quote, left wide diagrams on upright pages, let one bad learnings row silence every later search, and skipped pretty-printed timeline events without a word.Blast radius
make-pdf/src/render.ts,make-pdf/src/smartypants.ts,make-pdf/src/image-size.ts,bin/gstack-learnings-log,bin/gstack-learnings-search,bin/gstack-timeline-log,bin/gstack-timeline-read. No settings, defaults, dependencies, network, permissions or install changes. Rendering all 599 tracked Markdown files with main and with this branch changes only quote direction: 450 quote characters, every one from closing to opening at the start of a block, and nothing else.Security notes
javascript:spellings with tabs, line breaks, entity letters, padding past 2,048 characters, attributes right after a closing quote), parsed with htmlparser2 with tabs and line breaks stripped from URLs the way browsers do: main leaves 1,530 live, this branch 0.<animate>/<set>withattributeName=href),data:andvbscript:schemes, and a remotehrefinside an unclosed<svg>after a>in an earlier quoted attribute.Pre-Landing Review
Pre-Landing Review: 13 issues — 4 fixed, 0 asked, 1 deferred, 6 noted, 0 open. Four review rounds: two full rounds, then two read-only full reviews of later heads; the last one, at 3d90c13, came back with no blocking findings.
Deferred findings
make-pdf/src/render.ts:368The tab and entityjavascript:catch also rewriteshref=java	script:text that sits inside another URL's path. Main already rewrites the plainhref=javascript:spelling there the same way, so this is the existing fail-closed over-catch, not a new class.Review notes
on…=values holding>is slow to sanitize (128 KB took about 16 s; main 3 ms), because each handler rescans its tag. Ordinary documents are unaffected.details,summaryorlabelstill curls as closing, as on main.tsare now re-serialized, so duplicate keys collapse to the last value.Documentation
Status: current. No documentation edits were needed for this release.
Scope: 13 committed files (base fd81a04 to head eef1c54): make-pdf's untrusted-HTML sanitizer (javascript: links with tabs, line breaks or entity letters; click-handler values containing
>; colon-like numeric entities), smartypants quote context at block starts, SVG width parsing, and fixes to gstack-learnings-search, gstack-learnings-log, gstack-timeline-log and gstack-timeline-read. No staged, unstaged or new files.Documentation health:
Coverage debt: None critical. All changes are bug fixes with no new public surface. The minor reference gap is that the learn skill does not say this project's own learnings win over other projects' learnings with the same key.
Diagram drift: none found.
Tests
bun test make-pdf/test/: 383 pass, 0 fail; learnings and timeline tests: 131 pass, 0 fail (final check at 3d90c13; the only later commit edits the release note).bun run typecheckclean.Agent notes
The four small fixes come from GEVA-584's blind verification (handoff GST-3627), rewritten on current main; credit to GEVA-584. Its learnings-log patch also refused non-string
files; the verifier classed that as an improvement with no bug behind it, so it was left out. The three sanitizer additions are the rulings on #4762. Lane GSTA-832 for GStack Minder.Approvals
Approved: yes (record r-ef437527616b). The full approval record stays private.
Plan: exempt: bug fix (R65)
Plan check: exempt bug fix
REVIEW_LOOP: passes=4 blocking_found=4 deferred=1 noted=6 fixed=4 scope=frozen ledgers_read=4 dispatches=8
Gate edits: none detected (9 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Ruling: the final-review blocker p3/red-team#1 was fixed in 3d90c13 under GStack Minder's ruling A (approval a-b8eecd8bad9d), then the final head got one read-only full review.