Repository navigation
test(desktop): pin the exact-origin compare in the navigation guard - #23938
Conversation
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only adds unit tests in [UX-REVIEWED] 10ea5cc Description read[DESCRIPTION-READ] 61f42038b2b7a93375dc821fe0c1e1eaee745e0c7efa566072f9d16d44479c59 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The change only adds tests: it pins the exact-origin behaviour the guard already has and removes nothing. [DESIGN-REVIEWED] 10ea5cc Description read[DESCRIPTION-READ] 31b3a9ce7e66cc8316f94cc09cfee43f7ae08696ed5466b236fd745f230e4b8c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
805e81c to
10ea5cc
Compare
|
Review-ready on head 10ea5cc. All 107 checks pass, 0 failing; label 🤖 AI-assisted comment 🤖 |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (1 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: adds unit tests only, pinning the navigation guard's exact-origin compare against prefix-shaped look-alike URLs.
Problem / Motivation
Goal: The desktop navigation guard keeps refusing look-alike origins even if someone later swaps its exact compare for a string prefix.
createNavigationGuard(added in #23868) compares whole origins, but no test checked that. In his review of #23868, @cruisercohen showed that a prefix-match change leaves all 81 tests green (review).Why it matters
The guard stops a pane from taking over the main window. A prefix compare would let
https://crew.example.evil.test/pass ashttps://crew.example, and no test would notice.Not a goal
will-redirectguard and the iframesandboxitem still open on Display-media trust gate authorizes by frame shape, so a top-navigated pane passes it #10657.What changed (motivation → approach → change)
No test pinned the exact compare → add unit tests that call
createNavigationGuarddirectly with URLs that start with the app origin's text but are another origin.https://crew.example.evil.test/https://crew.examplehttp://localhost:5476@evil.example/http://localhost:5476http://localhost:54760/http://localhost:5476file:///app/index.htmlfile:///app/http://localhost:5476/chat?x=1http://localhost:5476Tests only, in
website/electron/test/external-scheme.test.js.Backwards compatibility
Compatible: tests only, no production code changes.
Removes nothing: the diff only adds tests.
Tests
external-scheme.test.js›createNavigationGuard pins the exact-origin compare: four refusals and one allow.Proof: not provable -- frontend test (prove.py runs Python only)
Mutant: the guard's check replaced with
String(url).startsWith(deps.getAppOrigin()). All four refusal tests go red and the allow test stays green. On the clean head,external-scheme+window-lifecyclepass 86 of 86. The new tests are pure (no clock, no I/O, no shared state); 10 repeats passed. Node 24 has no test-shuffle flag, so no shuffled run.Manual verification
N/A — unit coverage sufficient: the change is tests only.
Related Issues
Part of #10657
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)