Repository navigation
SECURITY: typst: backport GHSA-rw6x-h3xm-cvq5 fix (typst init template.path traversal) - #1002
Merged
Merged
Conversation
…e.path traversal) Verbatim format-patch of fdb38b89f1 (typst#8989, main only; upstream will not cut a patch release). Adds standalone tests mirroring upstream's smoke tests; both fail on unpatched 0.15.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 59 minutes for your next included review. View limit details
Comment |
norrietaylor
approved these changes
Oct 23, 2026
This was referenced Oct 26, 2026
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.
This backports the fix for GHSA-rw6x-h3xm-cvq5 (low) to typst 0.15.1.
The bug:
typst initfollows a package manifest'stemplate.pathout of the package, through..or an absolute path. That copies arbitrary readable directories (for example~/.ssh) into the new project. Affected range: 0.11.0–0.15.1; we ship 0.15.1.typst initis part of the binary we ship, so we're affected.The fix:
fdb38b89f1"Turn all manifest paths into virtual paths" (typst#8989), onmainonly. Upstream says it won't cut a patch release: symlinks inside a package can still lead out of it, which is intended behaviour today (typst#5454), so a patch release wouldn't meaningfully raise security. This backport closes the..and absolute-path vectors from the advisory; the symlink caveat is noted inbuild.ncl.The patch:
GHSA-rw6x-h3xm-cvq5.patchis a verbatimgit format-patchoffdb38b89f1.git apply --checkonv0.15.1succeeds with line offsets only, no fuzz. It touches 5 files, including upstream's own smoke tests.build.shapplies it withpatch -Np1underset -e, so a stale patch aborts the build instead of shipping unpatched.Tests, with a negative control
Two new standalone tests mirror upstream's smoke tests:
template_path_escape_refused: a local package whosetemplate.path = "../../../../secret"must maketypst initfail with "path escapes root" and copy nothing.template_path_absolute_is_package_relative:template.path = "/template"must resolve inside the package, not at the system root.Remote min sessions, arm64, freshly activated for each run:
min checkstandalone teststemplate_path_escape_refused(typst initfollowed the escaping path) andtemplate_path_absolute_is_package_relative(resolved at the system root)min check --packages typston this PR passes every check, with no Skip.Blast radius: typst only; nothing depends on it.
Follow-up: the vuln scanner can't see carried patches, so typst 0.15.1 will still show GHSA-rw6x as affected. It will need a VEX statement once this merges (drafted for Bryan; not filed). Once pkgs moves to stdlib 0.0.22, this is also a candidate for
attrs.revision = 1/attrs.patches[]under the new-rNscheme (minimal#1277, pkgmgr-rs#1036).nickel format --check,bash -nandmip dump(amd64 and arm64) all pass.🤖 Generated with Claude Code