Registry Mirror
Skip to content

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

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.html loading .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

  • (a) it resolves inside that page's own directory. Hidden segments are allowed and the containment and symlink checks are the same as v0.28.18.
  • (b) it resolves elsewhere in the selected folder, and no segment of its path under the folder is hidden or in the dotenv family. Both the requested path and the realpath are checked.

folderSessionAssetAllowed in packages/shared/html-assets-node.ts is the one rule. The Bun route, the Pi route and the share-link inliner all call it. resolveHtmlAssetRoute now 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 link
  • lessons/lesson.html → ../.secrets/x.json: 404, and not inlined
  • lessons/lesson.html → ../assets/lesson.css: 200
  • a symlink in the page's own directory that points into a hidden folder elsewhere in the selected folder: refused, and not inlined

The 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 typecheck is clean.

CLAUDE.md's "Embedded local documents" paragraph and the /api/html-assets route row now describe rules (a) and (b).

#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.
@backnotprop
backnotprop merged commit 456bc21 into main Oct 13, 2026
30 of 31 checks passed
@backnotprop
backnotprop deleted the fix/folder-own-hidden-assets branch October 13, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant