Skip to content

fix: only fill in session tokens for known Coder IDE links - #283

Merged
EhabY merged 6 commits into
mainfrom
fix/trusted-app-links-main
Oct 30, 2026
Merged

EhabY merged 6 commits into
mainfrom
fix/trusted-app-links-main

Conversation

@EhabY

@EhabY EhabY commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

External app links now follow the same $SESSION_TOKEN rules as the dashboard (coder/coder#31208).

  • The token is filled in only when the link opens a known Coder IDE handler, its url param is the sign-in URL or the deployment's dashboard_url from build info, and the placeholder is the token value.
  • Dev container (sub-agent) apps have the placeholder removed before anything else, as coderd does since fix!: validate workspace app URLs on the server coder#31262.
  • Links that need a token but don't match are shown disabled. The tooltip names both URLs when the link points to another deployment, and otherwise uses the dashboard's message.
  • Links that don't open a known Coder IDE handler ask for confirmation before opening, like the RDP prompt. "Don't ask again for scheme: links" saves the scheme in UserDefaults.
  • The VS Code links percent-encode the host and directory.
  • SDK: read parent_id from the workspace agent and dashboard_url from build info.
Decision log
  • Same rules as the dashboard: all clients agree on which links get a token.
  • dashboard_url kept in memory, not saved: an admin can change the access URL, so it's fetched again on each launch and sign-in.
  • Strip the placeholder for dev container apps: there's no token to protect, so old and new servers behave the same and the token can't reach those links.
  • Disabled icon instead of hiding the app: the tooltip says why it can't open and who can fix it.
  • NSAlert for the confirmation: same as the RDP prompt and InvalidAgents, since .alert doesn't work well from the menu bar.
  • Confirm only links outside the known handlers: IDE links stay one click.
  • Remember per scheme: like a browser's external protocol prompt. Uses the same checkbox and UserDefaults pattern as the hidden menu bar icon alert.
  • ASCII only, split on scalars: URL(string:) percent-encodes non-ASCII, and Swift compares strings by grapheme, so & or = followed by a combining mark would otherwise not split.

Same commits as #275, which merged into fix/xcode-27. That branch was later rewritten and no longer contains them. They sit directly on main, so this PR is #275's diff against main.

Tests: the menu UI and the confirmation alert weren't run by hand.

Generated with Coder Agents.

@EhabY EhabY self-assigned this Oct 30, 2026
@EhabY
EhabY requested a review from ethanndickson as a code owner October 30, 2026 07:45
@EhabY
EhabY requested a review from ethanndickson October 30, 2026 07:52
@EhabY
EhabY merged commit 7f3acb4 into main Oct 30, 2026
4 checks passed
@EhabY
EhabY deleted the fix/trusted-app-links-main branch October 30, 2026 08:02
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