Skip to content

test(desktop): pin the exact-origin compare in the navigation guard - #23938

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
test/10657-nav-guard-exact-origin
Oct 25, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
test/10657-nav-guard-exact-origin

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

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 as https://crew.example, and no test would notice.

Not a goal

What changed (motivation → approach → change)

No test pinned the exact compare → add unit tests that call createNavigationGuard directly with URLs that start with the app origin's text but are another origin.

Case URL App origin
prefix host https://crew.example.evil.test/ https://crew.example
userinfo http://localhost:5476@evil.example/ http://localhost:5476
longer port http://localhost:54760/ http://localhost:5476
opaque origin file:///app/index.html file:///app/
own origin (allowed) http://localhost:5476/chat?x=1 http://localhost:5476

Tests 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-lifecycle pass 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The diff only adds unit tests in website/electron/test/external-scheme.test.js. It adds or changes no user-visible control, so the missing blind read leaves no evidence gap.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 10ea5cc

Verdict parsed from the review's SHA-scoped output markers for commit 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 10ea5cc

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 10ea5cc7a5753c04e6758b44d02bb3af64f60c8c false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 25, 2026
@iamwhatever
iamwhatever force-pushed the test/10657-nav-guard-exact-origin branch from 805e81c to 10ea5cc Compare October 25, 2026 09:36
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main 663147f, which carries the governance-viewer test fix from #23933 (old head 805e81c, new head 10ea5cc). No code change. Scoped electron tests pass (86 of 86). CI is re-running.

🤖 AI-assisted comment 🤖

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 25, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 25, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready on head 10ea5cc. All 107 checks pass, 0 failing; label readiness: passed. GPT, Opus, Design and UX lanes pass with no blocking findings (First Principles skipped this revision); no unresolved threads. The branch is fresh against main (no overlap). The Windows installer job hit the known #21920 flake once and passed on one rerun. Tests only; the only remaining gate is a maintainer approval. Part of #10657.

🤖 AI-assisted comment 🤖

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 25, 2026 11:03

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit 8b5b210 into main Oct 25, 2026
114 of 115 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the test/10657-nav-guard-exact-origin branch October 25, 2026 11:03
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 25, 2026
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.

2 participants