Skip to content

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

Merged
ethanndickson merged 0 commit into
fix/xcode-27from
fix/trusted-app-links
Oct 30, 2026
Merged

ethanndickson merged 0 commit into
fix/xcode-27from
fix/trusted-app-links

Conversation

@EhabY

@EhabY EhabY commented Oct 28, 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.

Tests: CI fmt, lint and test pass. The menu UI and the confirmation alert weren't run by hand.

Generated with Coder Agents.

@ethanndickson ethanndickson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few comments inline.

Generated by an agent on behalf of the user

@ethanndickson

Copy link
Copy Markdown
Member

I can move this out of the stack before merging btw, so dw about those prs blocking this

@EhabY
EhabY requested a review from ethanndickson October 29, 2026 10:43
@coder coder deleted a comment from linear-code Bot Oct 29, 2026
@EhabY EhabY self-assigned this Oct 29, 2026
@ethanndickson
ethanndickson removed this pull request from stack #278 October 30, 2026 01:33
@ethanndickson
ethanndickson merged commit 3ff66f1 into fix/xcode-27 Oct 30, 2026
@ethanndickson
ethanndickson deleted the fix/trusted-app-links branch October 30, 2026 01:33
@ethanndickson

ethanndickson commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

??????????

When a PR's base branch contains its head, GitHub marks the PR as merged.
Reopen and I can approve 😭

@ethanndickson
ethanndickson restored the fix/trusted-app-links branch October 30, 2026 01:36
EhabY added a commit that referenced this pull request Oct 30, 2026
External app links now follow the same $SESSION_TOKEN rules as the
dashboard (coder/coder#31208).

- Fill in the token only when the link opens a known Coder IDE handler,
  its `url` param is the sign-in URL or the deployment's `dashboard_url`,
  and the placeholder is the `token` value.
- Strip the placeholder from dev container (sub-agent) apps, matching
  coderd since coder/coder#31262.
- Show links that need a token but don't match as disabled, with a
  tooltip explaining why.
- Ask for confirmation before opening links outside the known IDE
  handlers. "Don't ask again" is remembered per scheme in UserDefaults.
- Percent-encode the host and directory in VS Code links.
- SDK: read `parent_id` from the workspace agent and `dashboard_url`
  from build info.

Originally reviewed in #275
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