Repository navigation
refactor: define session token link handlers once in codersdk - #31767
Open
dylanhuff-at-coder wants to merge 14 commits into
Open
dylanhuff-at-coder wants to merge 14 commits into
dylanhuff-at-coder wants to merge 14 commits into
Conversation
…en app coder open app substituted $SESSION_TOKEN into every external app URL on a top-level agent. It now applies the dashboard's trusted-link check: the link must open a known Coder IDE handler whose url param is this deployment, and the placeholder must be its token. Other links are printed with a warning and not opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…links Strip one leading ? before parsing params, like URLSearchParams, so a duplicate url can't hide behind it. Lowercase hosts as ASCII only and reject non-ASCII hosts, since Unicode folding mapped hosts such as codİng.com onto a trusted host that browsers resolve elsewhere. Narrow the docs: the dashboard leaves http and https links enabled without a token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split params on & only so a ; in another value no longer rejects a link the dashboard trusts, and compare ports numerically so :0443 matches the default port. Out-of-range ports are rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oard Move the trusted-link cases into sessionTokenDestinationCases.json and run them from both cli/open_internal_test.go and apps.test.ts, so the two checks can't drift apart without a test failing. Add a case that only the decoded-view check rejects, and point apps.ts at the Go copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…served test host Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the deep-link handlers that may receive the session token into codersdk and generate them into typesGenerated.ts, so coder open app and the dashboard read one list instead of two hand-kept copies. Use VSCodeCoderExtensionID for the hard-coded coder.coder-remote links. Co-authored-by: Ehab Younes <ehab.alyounes@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…usted-token-links
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-links' into dylan/codersdk-session-token-handlers
…n-token-handlers # Conflicts: # cli/open.go # site/src/modules/apps/apps.ts
dylanhuff-at-coder
requested review from
a team,
SasSwart,
jdomeracki-coder,
johnstcn and
ssncferreira
as code owners
November 5, 2026 17:39
dylanhuff-at-coder
changed the base branch from
dylan/cli-open-app-trusted-token-links
to
main
November 5, 2026 17:39
dylanhuff-at-coder
marked this pull request as draft
November 5, 2026 17:40
dylanhuff-at-coder
marked this pull request as ready for review
November 9, 2026 21:23
dylanhuff-at-coder
temporarily deployed
to
main
November 9, 2026 21:23 — with
GitHub Actions
Inactive
ssncferreira
removed their request for review
November 12, 2026 10:07
Collaborator
|
@dylanhuff-at-coder reviewing now. |
SasSwart
approved these changes
Nov 17, 2026
This branch was previously deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to #31721.
coder open appand the dashboard each kept their own copy of the deep-link handlers that may receive the session token. The shared test fixture from #31721 catches the two checks behaving differently, but only for links someone wrote a case for. Adding a new editor to just one list wouldn't fail any test, and that one-sided change is how the CLI gap #31721 fixes happened in the first place.This moves the handlers into
codersdk(VSCodeSessionTokenSchemes,VSCodeSessionTokenPaths,VSCodeCoderExtensionIDandJetBrainsSessionTokenHandlers) and generates them intotypesGenerated.ts, socli/open.goandsite/src/modules/apps/apps.tsboth build their lists from one source. The hard-codedcoder.coder-remotein the VS Code link builders now usesVSCodeCoderExtensionIDtoo.No behavior change. The 55 shared cases from #31721 pass unchanged against both sides. The
codersdkconstants come from @EhabY's #31261, which had the same idea.Kept out of #31721 on purpose: the security fix needs to backport cleanly to every supported release, and a new
codersdkAPI plus regenerated types would widen every backport. This one ismainonly.🤖 Generated with Claude Code