Conversation
#1568 made the selected folder the asset root in folder sessions and refused hidden paths under it, which also refused a page's own hidden asset folders: `site/page.html` loading `.vendor/x.css` answered 200 on v0.28.18 and 404 now. Each folder-session token now names its page's directory (one token per page directory), and an asset is allowed when either (a) it resolves inside that directory, hidden segments included, with the same containment and symlink checks as v0.28.18, or (b) it resolves elsewhere in the selected folder and no segment of its path under the folder, as requested and by realpath, is hidden or dotenv. One rule, folderSessionAssetAllowed (packages/shared/html-assets-node.ts), for the Bun route, the Pi route and the share-link inliner; the route decision now carries its token. A page inside a hidden folder (`.drafts/`) still keeps its own directory as its root (rule (a) only). Tests in both runtimes and the inliner: site/page.html -> .vendor/x.css 200 and inlined; lessons/lesson.html -> ../.secrets/x.json 404 and not inlined; lessons/lesson.html -> ../assets/lesson.css 200; a symlink in the page's directory into a hidden folder elsewhere in the folder refused.
1 task
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.
Release-blocking for 0.28.19: a regression from #1568, found in release QA.
The regression
In a folder annotate session, a page that loads assets from a hidden folder below its own directory gets a 404. For example,
site/page.htmlloading.vendor/x.css(or.vitepress/...) answered 200 on v0.28.18 and 404 on main. Before #1568 the page's own folder was its root and hidden paths were allowed; #1568 refused hidden paths anywhere under the widened folder root.The fix
Each folder-session token now names its page's directory (one token per page directory). An asset is served when either
folderSessionAssetAllowedinpackages/shared/html-assets-node.tsis the one rule. The Bun route, the Pi route and the share-link inliner all call it.resolveHtmlAssetRoutenow includes the request's token in its serve decision. A page inside a hidden folder (.drafts/page.html) still keeps its own directory as its root, so only rule (a) applies to it, unchanged from #1568. Single-file sessions and the Inbox are unchanged.Tests
In both runtimes, plus the share inliner:
site/page.html→.vendor/x.css: 200, and inlined in the share linklessons/lesson.html→../.secrets/x.json: 404, and not inlinedlessons/lesson.html→../assets/lesson.css: 200The new tests fail on current main (3 failures) and pass with the fix. The HTML-asset, Inbox-attachment, open-in and Pi server suites pass (321 tests), and
bun run typecheckis clean.CLAUDE.md's "Embedded local documents" paragraph and the
/api/html-assetsroute row now describe rules (a) and (b).