Repository navigation
CLI stops steering the OpenAI key into .agentic.yml (#59) - #66
Open
minerva-sky wants to merge 2 commits into
Open
minerva-sky wants to merge 2 commits into
minerva-sky wants to merge 2 commits into
Conversation
The missing-token error and the README told users to run `agentic config set api_token=...`. That writes plain-text YAML to $PWD/.agentic.yml, which is not gitignored, and nothing in lib/ ever reads api_token back: LegacyConfiguration takes the token from OPENAI_ACCESS_TOKEN / AGENTIC_API_TOKEN only. The advice stored a secret one `git add .` from a public repo and did not even work. - check_api_token! now names the paths that work: the env vars, Agentic.configure, or a local endpoint via AGENTIC_API_BASE_URL. - README drops the api_token example and says why the key stays out of .agentic.yml. - `config set` refuses credential-shaped keys (token, key, secret, password as whole name segments; "tokenizer" still passes) and exits non-zero without writing. - Specs: refusal writes nothing, non-secret keys still work, the error text no longer mentions .agentic.yml. The existing placeholder key `test_key` is renamed `test_option` because it trips the guard. Closes codenamev#59 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Whole-segment matching let apiKey, api-key, apikey and accessToken through. The key check is a plain substring match now, and a value that looks like an OpenAI key is refused whatever the key is called. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Closes #59.
The missing-token error (
check_api_token!) and two README sections told users to runagentic config set api_token=.... That writes plain-text YAML to$PWD/.agentic.ymlwith umask permissions, the file is not gitignored (this repo's own.gitignoreignores.envbut not.agentic.yml), and nothing inlib/ever readsapi_tokenback:LegacyConfigurationtakes the token fromOPENAI_ACCESS_TOKEN/AGENTIC_API_TOKENonly, andactive_configis consumed byconfig listandconfig getalone. So the advice stored a secret onegit add .from a public repo, and the user got the same error box on the next run.What changes
Agentic.configure { |c| c.access_token = ... }, orAGENTIC_API_BASE_URLfor a local endpoint that needs no token. The.agentic.ymlandconfig set api_token=lines are gone.api_tokenexample from the command list and from the configuration section, and says why the key stays out of.agentic.yml.config setrefuses credentials. Keys containingtoken,key,secret,passw, orcredentialin any spelling (api_token,apiKey,api-key,apikey,accessToken), and values shaped like an OpenAI key (sk-...) under any key name. It prints why and exits 1 before any read or write. The substring match is deliberate: a false positive such asmax_tokencosts a rename and the message says so, a false negative costs a secret.Nothing else about
.agentic.ymlchanges: existing files still load,config getstill reads whatever is in them, andmodelremains the example key. Making the home-directory file actually carry a token (0600 write plus a reader) is the product call the issue leaves for a separate ask.Tests
spec/agentic/cli/config_commands_spec.rb: eleven credential-shapedKEY=VALUEforms all exit non-zero withsave_confignever called;model=gpt-4o-ministill writes.spec/agentic/cli_spec.rb: the error text namesOPENAI_ACCESS_TOKENandAgentic.configureand no longer mentions.agentic.yml. The existing placeholder keytest_keyis renamedtest_optionbecause it trips the guard. Full suite on the first commit: 1394 examples, 1 failure (theevent_dispatcher_integration_spec.rb:291timing flake that #36 addresses); CLI specs re-run green on the final commit, StandardRB clean.Side finding, not changed here:
lib/agentic/cli/config.rbdefines a secondCLI::Configclass with the same commands that nothing references (cli.rbwiresConfigCommands). It still has the unguardedset. Dead code; worth its own removal.Panel
private_constant,Thor::Erroroverexit 1) noted, the guard copies the invalid-format branch's existingexit 1for consistency.apiKey,api-key,apikey,accessTokenwalked through, and values were never checked. Fixed: substring key match plus thesk-value check. Re-run 3/3 cleared; residual gaps (other vendors' token shapes under innocuous keys, URL userinfo) are out of scope for closing the paths the CLI itself advertised.instance_doublepins the configuration seam.config set api_token=exiting 1 is a CLI behaviour change without a warn-first release. Rebuttal: the old call never did anything but leak, a warn-first release would keep writing plain-text secrets, the gem is pre-1.0, and the CHANGELOG carries it under Security.🤖 Generated with Claude Code