Title: bug: keyring session store keys entries by host, so http and https deployments share a token · Issue #29290 · coder/coder · GitHub
Open Graph Title: bug: keyring session store keys entries by host, so http and https deployments share a token · Issue #29290 · coder/coder
X Title: bug: keyring session store keys entries by host, so http and https deployments share a token · Issue #29290 · coder/coder
Description: Is there an existing issue for this? I have searched the existing issues Current Behavior The keyring session store keys entries by host only. normalizeHost in cli/sessionstore/sessionstore.go returns strings.ToLower(u.Host), so http://c...
Open Graph Description: Is there an existing issue for this? I have searched the existing issues Current Behavior The keyring session store keys entries by host only. normalizeHost in cli/sessionstore/sessionstore.go retu...
X Description: Is there an existing issue for this? I have searched the existing issues Current Behavior The keyring session store keys entries by host only. normalizeHost in cli/sessionstore/sessionstore.go retu...
Opengraph URL: https://github.com/coder/coder/issues/29290
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: keyring session store keys entries by host, so http and https deployments share a token","articleBody":"### Is there an existing issue for this?\n\n- [X] I have searched the existing issues\n\n### Current Behavior\n\nThe keyring session store keys entries by host only. `normalizeHost` in `cli/sessionstore/sessionstore.go` returns `strings.ToLower(u.Host)`, so `http://coder.example.com` and `https://coder.example.com` map to the same entry. Every command that runs with `--url http://coder.example.com` and `--use-keyring=true` therefore uses the token that was stored for the `https` deployment:\n\n* `coder login token --url http://coder.example.com` prints the `https` token.\n* `coder logout --url http://coder.example.com` sends that token to `http://coder.example.com` in `client.Logout()` and then deletes the shared entry, signing the `https` session out.\n* Any other command, such as `coder ssh`, sends the `https` token in cleartext to the `http` URL.\n* `coder login http://coder.example.com --use-token-as-session` overwrites the `https` entry with the `http` token.\n\n**File** mode already guards against this. `coder login token` compares the stored URL with `--url` and refuses with `file session token storage only supports one server at a time` when they differ. The keyring path has no such check.\n\nThe main way to hit this is a mistyped or misconfigured URL: a user who is signed in to `https://coder.example.com` in the terminal and points a client at `http://coder.example.com` leaks the `https` token over plaintext. The VS Code extension defaults `coder.useKeyring` to `true` in coder/vscode-coder#1107 and shares the CLI's store, so the same host-keyed entry is used by both.\n\n### Relevant Log Output\n\n```shell\n$ coder login https://coder.example.com --use-keyring=true\n# ...signed in...\n$ coder login token --url http://coder.example.com --use-keyring=true\n\u003cprints the https session token>\n```\n\n### Expected Behavior\n\nKeyring entries are scoped to the full origin (scheme, host, and port), or the keyring read compares the stored URL with `--url` the way file mode does and refuses on a mismatch. Either way, `coder login token --url http://coder.example.com` fails with a clear error instead of printing a token for a different scheme.\n\n### Steps to Reproduce\n\n1. On macOS or Windows, run `coder login https://coder.example.com --use-keyring=true` and sign in.\n2. Run `coder login token --url http://coder.example.com --use-keyring=true`.\n3. The `https` session token is printed. Running `coder logout --url http://coder.example.com --use-keyring=true` sends it to the `http` URL and removes the `https` session.\n\n### Environment\n\n* **Host OS**: macOS or Windows (any platform with keyring support)\n* **Coder Version**: main at 9548f239a8bdfe74d0f62eafc41c97b2d7adca91 (after 2.32.0)\n\n### Additional Context\n\nRelated to #29105, which also touches how clients share the CLI's keyring store.","author":{"url":"https://github.com/EhabY","@type":"Person","name":"EhabY"},"datePublished":"2026-09-14T14:23:47Z","url":"https://github.com/coder/coder/issues/29290"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:41e465f3-477d-086c-ce95-cc9ff7dbf18b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E3B6:3D97C8:BB8793:FB7A44:6B00F65B |
| html-safe-nonce | b490c49dabeed25be8ee22f8cb3eba71dbc2cdb3829699939ea4ddd34f58fab8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0I2OjNEOTdDODpCQjg3OTM6RkI3QTQ0OjZCMDBGNjVCIiwidmlzaXRvcl9pZCI6Ijg4MzU4OTk0NTA5MTc0NTEzNTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f0e29f83b4c39f0746de88cb9294cb180683aa208273ce903c67d40ddf8d2db9 |
| hovercard-subject-tag | issue:5450578063 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/29290/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9a861a07e9c1a62be5f538f2b91abbd1ad74ffecbb2b684aa2641f16344af13e/coder/coder/issues/29290 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9a861a07e9c1a62be5f538f2b91abbd1ad74ffecbb2b684aa2641f16344af13e/coder/coder/issues/29290 |
| og:image:alt | Is there an existing issue for this? I have searched the existing issues Current Behavior The keyring session store keys entries by host only. normalizeHost in cli/sessionstore/sessionstore.go retu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | EhabY |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width