Repository navigation
fix(security): close symlink containment gaps in link and image sinks - #502
Merged
Merged
Conversation
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
Closes the ARCH-08a sink-census gaps G1–G4 (TODO SINK-01): relative links and pasted images now check the real (symlink-resolved) path, not just the lexical one.
Changes
assets/is created. An existing<sha>.pngis accepted only as a single-link regular file, so a symlink or hardlink leaf (e.g. pointing at the document) is refused.codeReferenceFileExistsWithinRootuses the same realpath containment, pinned by real temp-dir symlink tests.<img>(src + srcset) issues no request, via a request-recording probe in the browser test server.real-containment.ts, nearest existing ancestor for missing targets) plus a per-segment..comparator fix.Unreleased → Changedline.Related
.claude/plans/sink-01-close-census-gaps.md(review-plan APPROVED, stamp c3e3328aa8ef)Test Plan
pnpm compile,pnpm lint→ exit 0pnpm vitest run→ 6546/6549. The 3 failures (test/webview/editor.test.tsfold reseed,test/webview/shell.test.tsoversized-switch ×2) are in files this PR doesn't touch; all 216 tests in those files pass when the files run alone (load flake)pnpm test:browser→ 99/100. The one failure (outline-sidebar-layoutpin grace window) is untouched by this PR; the file passes 7/7 alone. The newrich-paste-no-fetchfile passes 2/2env -u ELECTRON_RUN_AS_NODE pnpm test:e2e→ 134 passing (re-run after the rebase onto main)pnpm package→ audit-vsix: no violationsnlink === 1dropped: the hardlink row goes redinnerHTMLparse: red, withsrc.pngin the diff;git diff src/empty after restoreDocs follow-up (for the parent session)
.claude/docs/ARCHITECTURE.mdimage-write rows (the two "content-hash 名でassets/へ書込" lines, currently near :357 and :376): append "realpath containment in the document folder, symlink leaf refused". ARCHITECTURE has no open-link containment description to change..claude/docs/LEARNING.md"2026-11-05: ARCH-08a sink census": in the census table update the guard and test columns of the G1–G3 rows and clear the gap column; in the Gap section end each G1–G4 line withclosed by SINK-01 (PR #<n>)(<n>stays a literal placeholder in the PR body; the parent session fills in this PR's number after merge); fix the..component comparator note.SECURITY.mdhas no symlink, realpath or lexical wording (grep confirmed), so it is unchanged.