Repository navigation
fix(artifacts): allow same-site navigations, fit Mermaid, inset the focused view - #5543
shepherdjerred wants to merge 1 commit into
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
…ocused view Why Live acceptance of the artifacts service found that a link from Hub, Tracker or Flags got 403 (same-site GET navigations were rejected), Mermaid rendered tiny, and the floating pill covered the top of the focused viewer (the cast and the video controls). A framed hostile form also turned the viewer frame into a Chrome error page; that needed an explanation and a test. What - csrf: a GET/HEAD top-level document navigation (Sec-Fetch-Mode navigate, Dest document) is allowed when Sec-Fetch-Site is same-site, as it already was for none. cross-site navigations, frame navigations, every non-GET and same-site or cross-site subresource requests are still refused. - Framed form POST: not a missing header. form-action 'none' is enforced and reported; the frame's error page is Chrome refusing the navigation under the app page's frame-src, and no request reaches the app. The e2e content host now serves the real contentHeaders, the e2e app listener logs requests, and a hostile-fixture spec asserts nothing reaches the app (POST, GET, popup). - The focused viewer starts below the pill (--ar-inset-top, published by the pill from its own measured bottom edge). The Mermaid viewer fits the frame (scale up to 3x natural, down as needed, held to the frame height unless it is already at natural size); the e2e content host serves the real viewer. Verification bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts (454 unit tests, conformance allowlist unchanged); bun run test:e2e (desktop, mobile, webkit: 239 passed); root //#knip //#jscpd //#check-flag-usage //#check-directory-file-counts //#quality-ratchet; lefthook pre-commit. Not run: live deployment checks, PostgreSQL extended tier (no change to it). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
08f5c8d to
25c169c
Compare
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
@coderabbitai review Automated re-review request for |
Action not completed
|
|
@codex review Automated re-review request for |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
Live acceptance of the
artifactsservice found four problems: links into artifacts from Hub, Tracker and Flags returned 403; Mermaid rendered tiny; the floating pill covered the top of the focused viewer (cast, video controls); and a hostile framed form turned the viewer frame into a Chrome error page, which needed explaining and a regression test.What
src/domain/csrf.ts): GET/HEAD top-level document navigations (Sec-Fetch-Mode: navigate,Dest: document) are allowed whenSec-Fetch-Siteissame-site, as they already were fornone.cross-sitenavigations (a sandboxed artifact), frame navigations, every non-GET that is not same-origin, and same-site/cross-site subresource or API requests stay 403.form-action 'none'is enforced and reports a violation; the frame's error page is Chrome refusing the navigation under the app page'sframe-src <content origin>(the frame cannot navigate to the app origin), and no request is sent. Proven with a two-host e2e and an app-side request log (see Demo). The CSRF guard remains the second line. The e2e content host now serves the realcontentHeadersinstead of a drifted copy.--ar-inset-top, published by the pill from its measured bottom edge plus 8 px). The canvas does not use it.acceptance-scratcharchived viaboards.archive;acceptance-liveuntouched.Demo
Focused views, before and after
Navigation guard matrix (generated from
checkCsrf)Framed hostile form: where the request dies
Two-host e2e (
e2e/hostile-frame.spec.ts), a form with no target posting at the app origin from inside the viewer frame. The app listener logs every request before any handler runs.frame-src'none'(shipped)chrome-error://), console reports both violations'none'*frame-srcblocks it)*POST /api/_e2e/probe,Sec-Fetch-Site: cross-site,Dest: iframe(the CSRF guard answers 403 in production)Each directive is independently sufficient to stop the request; both are shipped. The test fails when both are loosened.
Verification
bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts: green (454 unit tests; conformance allowlist unchanged).bun run test:e2einpackages/artifacts(desktop, mobile, webkit): 239 passed, including the newhostile-frameandfocused-insetspecs and the updatedshellspec (the focused viewer no longer starts at y=0).//#knip //#jscpd //#check-flag-usage //#check-directory-file-counts //#quality-ratchet: green.bunx lefthook run pre-commit: green.@shepherdjerred/artifactsis affected (no PostgreSQL or schema change).🤖 Generated with Claude Code
https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT