Skip to content

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

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

EhabY merged 6 commits into
mainfrom
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. "Don't ask again for scheme: links" saves the scheme in app-link-settings.json.
  • 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 button instead of hiding the app: the tooltip says why it can't open and who can fix it.
  • Flyout for the confirmation: the tray window is 300 px wide, narrower than ContentDialog's minimum width. LauncherOptions.TreatAsUntrusted is ignored in desktop apps.
  • Confirm only links outside the known handlers: IDE links stay one click.
  • Remember per scheme: like a browser's external protocol prompt. Stored in a new AppLinkSettings through the existing SettingsManager<T>, separate from the Coder Connect settings. A corrupt file shows the usual "Could not open app" error, like the Coder Connect settings.
  • Check and replace on Uri.OriginalString: Uri.ToString() unescapes the link. The click checks again with the credentials whose token it uses.

Tests: CI build, fmt and test pass. The tray UI wasn't run by hand.

Generated with Coder Agents.

@coder coder deleted a comment from linear-code Bot Oct 29, 2026
@EhabY EhabY self-assigned this Oct 29, 2026
@EhabY
EhabY requested a review from deansheather October 29, 2026 11:50
Comment thread App/ViewModels/AgentAppViewModel.cs Resolved
Comment thread App/ViewModels/AgentAppViewModel.cs Resolved
Comment thread App/Views/Pages/TrayWindowMainPage.xaml Resolved
@EhabY
EhabY force-pushed the fix/trusted-app-links branch from bcd53c3 to fa16fbb Compare October 30, 2026 15:50
@EhabY
EhabY requested a review from untra October 30, 2026 15:56
- Add ISettingsManager.Update, which reads, changes and writes under one
  lock, so saving a trusted scheme can't race with another update.
- Await the confirmation flyout's choice so one command run covers the
  whole flow and can't stack a second flyout.
- Add a Settings button that clears the trusted schemes.
- Shorten the message shown for untrusted links.
@EhabY
EhabY force-pushed the fix/trusted-app-links branch from fa16fbb to 5cc728a Compare October 30, 2026 16:09
@EhabY
EhabY merged commit fcd75eb into main Oct 30, 2026
3 checks passed
@EhabY
EhabY deleted the fix/trusted-app-links branch October 30, 2026 19:51
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