Repository navigation
feat(providers): read provider keys from the freedesktop keyring - #105
Merged
Merged
Conversation
A plugin started by the graphical session inherits the user manager's environment and never an interactive shell's exports, so a key exported in ~/.bashrc never reaches an adapter. The OpenRouter, GLM / Z.ai and OpenCode Go adapters can now read the key from the keyring at the moment of use. The environment carries only a lookup spec, AIOC_VAULT_OPENROUTER and its siblings, which names the secret-tool attributes. The spec is not a secret, so it can live in a display manager or user-service environment file, and the key never enters a process environment, a child process, a cache or a log. An exported key still wins, and AIOC_VAULT_TIMEOUT bounds the lookup so a locked keyring cannot stall a refresh. Readiness accepts a spec without performing a lookup, so the settings page cannot raise a prompt. The test covers the key reaching curl, exported-key precedence, the bound, a missing secret-tool, and readiness without a lookup. Signed-off-by: Álvaro Tejero Cantero <[email protected]>
A refresh runs with nobody in front of it, but secret-tool unlocks a locked collection before it answers, so every refresh could raise the unlock dialog again. Ask the Secret Service first with SearchItems, which sorts matches into unlocked and locked items without prompting, and skip an entry that is locked or absent. The bounded lookup still covers a bus that cannot be asked. The spec was split by an unquoted expansion, so a * in it was matched against the working directory. Split it with read -a instead, and ignore a spec that is not attribute/value pairs, in readiness too. A malformed AIOC_VAULT_TIMEOUT now falls back to the default instead of making timeout(1) fail. The docs listed AIOC_VAULT_ZAI on the GLM row although the GLM adapter never read it. GLM now reads its own AIOC_VAULT_GLM, and the docs say the key travels through curl's --config pipe rather than claiming it never reaches a child process. Signed-off-by: Bernardo Pinto Gomes <[email protected]>
Signed-off-by: Bernardo Pinto Gomes <[email protected]>
6 of 10 tasks
5 of 10 tasks
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.
Summary
Supersedes #102 and keeps its commit by @alvorithm, with one follow-up commit on top.
Dux Shell runs as a systemd user service, so it never inherits an interactive shell's exports. #102 lets the OpenRouter, Z.ai and OpenCode Go adapters read their key from the freedesktop keyring at the moment of use. The environment carries only a lookup spec such as
AIOC_VAULT_OPENROUTER="service openrouter username quota", which is not a secret.The follow-up commit fix(providers): never prompt from a background keyring lookup changes four things:
secret-tool lookupunlocks a locked collection before it answers, so each refresh could raise the unlock dialog again. Before reading, the adapter now calls the Secret Service'sSearchItemsover D-Bus (busctl), which sorts matches into unlocked and locked items without prompting. It skips an entry that is locked or absent. If the bus cannot be asked, the bounded lookup (AIOC_VAULT_TIMEOUT) still runs.*in it matched files in the working directory. It is now split withread -a. A spec that is not attribute/value pairs is ignored, in readiness too. A malformedAIOC_VAULT_TIMEOUTfalls back to the default instead of makingtimeout(1)fail.AIOC_VAULT_ZAIon the GLM row, but the GLM adapter never read it. GLM now reads its ownAIOC_VAULT_GLM, in the adapter and in readiness.--configpipe, rather than claiming it never reaches a child process. They describe the store/spec workflow and the locked-entry behaviour, and add a troubleshooting pointer.I verified it against a real Secret Service with a throwaway entry, which I removed afterwards:
SearchItemsreportedunlocked, the key came back, and aftersecret-tool clearit reportedabsentand no lookup ran.tests/test-vault-keys.shuses a fakebusctlandsecret-toolto cover:Related issues
Supersedes #102.
Type of change
Checklist
plugin.json.versionandCHANGELOG.mdare consistent (not release-bearing;## Unreleasedbullet)i18n/en.jsonkeys have translations in every locale (no new strings; readiness details are not translated)git commit -s) under the DCOLocal gates:
check-metadata,check-changelog,check-dco,bash -n,shellcheck -S warning,qmllint,actionlint,gitleaks, everytests/test-*.sh(including the native widget runtime on Wayland), andAIOC_COVERAGE_MIN=95 scripts/coverage.