Title: feat(cli): allow keyring session token storage together with `--global-config` · Issue #29105 · coder/coder · GitHub
Open Graph Title: feat(cli): allow keyring session token storage together with `--global-config` · Issue #29105 · coder/coder
X Title: feat(cli): allow keyring session token storage together with `--global-config` · Issue #29105 · coder/coder
Description: Problem ensureTokenBackend() in cli/root.go forces the file-based backend whenever --global-config / CODER_CONFIG_DIR is set to anything other than config.DefaultDir(), regardless of --use-keyring: assumeExtensionInUse := r.globalConfig ...
Open Graph Description: Problem ensureTokenBackend() in cli/root.go forces the file-based backend whenever --global-config / CODER_CONFIG_DIR is set to anything other than config.DefaultDir(), regardless of --use-keyring:...
X Description: Problem ensureTokenBackend() in cli/root.go forces the file-based backend whenever --global-config / CODER_CONFIG_DIR is set to anything other than config.DefaultDir(), regardless of --use-keyring:...
Opengraph URL: https://github.com/coder/coder/issues/29105
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(cli): allow keyring session token storage together with `--global-config`","articleBody":"## Problem\n\n`ensureTokenBackend()` in `cli/root.go` forces the file-based backend whenever `--global-config` / `CODER_CONFIG_DIR` is set to anything other than `config.DefaultDir()`, regardless of `--use-keyring`:\n\n```go\nassumeExtensionInUse := r.globalConfig != config.DefaultDir() && !r.useKeyringWithGlobalConfig\nkeyringSupported := runtime.GOOS == \"windows\" || runtime.GOOS == \"darwin\"\nif r.useKeyring && !assumeExtensionInUse && keyringSupported {\n\t...\n}\n```\n\nThis was introduced in #20943 as a compatibility shim after #20851 enabled keyring storage by default, since editor extensions invoke the CLI with `--global-config` and assumed the session token would be readable from disk. The code comment already flags it as temporary.\n\nTwo consequences today:\n\n1. **Keyring and per-deployment config isolation are mutually exclusive.** Any client that needs its own config directory (editor extensions, CI wrappers, multi-deployment setups) is forced back to a plaintext `session` file on disk. There is no way to opt in.\n2. **Clients cannot hold independent tokens for the same deployment.** The keyring entry is a single JSON credentials map keyed only by normalized host, stored under the `coder-v2-credentials` service name (`cli/sessionstore/sessionstore.go`). Any two clients pointing at the same deployment necessarily share one credential, so a logout in one revokes the session for the other.\n\n## Proposal\n\nAllow `--use-keyring` to be honored when `--global-config` is set, and give callers a way to scope their credential so it does not collide with the shared default entry. Rough shape:\n\n- Drop the `assumeExtensionInUse` short-circuit and treat `--use-keyring` as authoritative. Keep file storage as the default when `--global-config` is set so existing callers are unaffected unless they explicitly opt in.\n- Support a distinct keyring namespace per caller, either derived from the config directory or set explicitly (the existing `keyringServiceName` field is test-only today, `WithKeyringServiceName`). Callers that want to share credentials with Coder Desktop keep using `DefaultServiceName`; callers that want isolation get their own.\n\n## Open questions\n\n- Should the namespace be derived from the config directory path, or an explicit flag? A derived value is transparent to callers but makes the credential name depend on a filesystem path, which is awkward to document and to clean up.\n- If a caller uses an isolated namespace, credential sharing with Coder Desktop and the JetBrains Toolbox plugin is lost for that caller. Is that acceptable as opt-in behavior?\n- What should happen on `logout` when both a default-namespace and an isolated credential exist for the same host?\n- Linux still has no keyring implementation (`sessionstore_other.go` returns `ErrNotImplemented`), so this stays macOS/Windows only.\n\n## Related\n\n- #20851 - enabled keyring usage by default in the CLI\n- #20943 / #20953 - added the `--global-config` short-circuit this issue proposes to lift\n- #19403 - original keyring storage tracking issue\n\nCreated on behalf of @EhabY","author":{"url":"https://github.com/apps/blinkagent","@type":"Person","name":"blinkagent"},"datePublished":"2026-09-08T15:43:44Z","url":"https://github.com/coder/coder/issues/29105"}
| 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:eb454afe-2416-a8d1-d3d2-2a0c66eb7131 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8672:36A3E:CF9B84:11604C8:6B010086 |
| html-safe-nonce | f90aebf958b928b17d44ab06c37f1af119f1d25c9b860701cffed86618059682 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjcyOjM2QTNFOkNGOUI4NDoxMTYwNEM4OjZCMDEwMDg2IiwidmlzaXRvcl9pZCI6IjU0MzgyNTYwOTI3MDAyNzg5MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ea1915cf6308ab117f9d489d1e299a9bcdd1ee7d42945e03195b99b25ec9ae02 |
| hovercard-subject-tag | issue:5388846563 |
| 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/29105/issue_layout |
| twitter:image | https://opengraph.githubassets.com/784769a3b10dc80831bfe65ba0e66b7fd2f356817ad71e8b5079ad16372faaf5/coder/coder/issues/29105 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/784769a3b10dc80831bfe65ba0e66b7fd2f356817ad71e8b5079ad16372faaf5/coder/coder/issues/29105 |
| og:image:alt | Problem ensureTokenBackend() in cli/root.go forces the file-based backend whenever --global-config / CODER_CONFIG_DIR is set to anything other than config.DefaultDir(), regardless of --use-keyring:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | blinkagent[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width