Repository navigation
Conversation
|
Thanks @dhruv1220, this is a careful PR and the test reproduces #55 well. We’re going to fix it a different way, for two reasons. Kebab-case names, which most plugins and marketplaces use, still match (token-saver, secret-scanner), so the bug stays for most of them. And the word-boundary rule stops redacting some all-lowercase secret keys that main redacts today, such as accesstokenvalue or secretkeyid, which we’d rather not trade in this code. Instead we’ll treat the keys of known name tables (marketplaces, plugins, MCP servers, providers) as names rather than field names, and keep the field check as it is. I’ll close this, but once it lands we'll credit to you in the changelog. Thanks again!
|
…aken for secrets Redact judged every key by redactName's substring rule, so a plugin, a marketplace or an MCP server named tokeneconomizer, token-saver or secret-scanner had all its settings replaced with devvm-redacted, and Claude Code refused the VM's settings.json whole (#55). Each agents.Def now lists the tables of its settings files whose keys are names you choose (Names: a table under a name isn't judged by its name) and the tables of settings keyed by names (NamedValues: neither a table nor a setting's word, lower-case letters and dashes such as off, is), read from each agent's docs; agents.NameTables is their one union, which Redact applies to every agent's files. Fields under a name are judged as before: the substring rule, wholeTable, secretShape and the URL and text scrubbing. Any other value right under a names table is still judged by its key, a name that's env or headers still makes a table of secrets, and a * in a table's path never stands for a list's element. The trade-off: a table with a secret-looking key right under a name, such as {"mcp": {"tokens": {...}}}, is no longer replaced whole; no agent's schema has one there, and the fields inside it are still judged. Tests: TestRedactNames (Claude Code's, Codex's, opencode's and pi's names, kebab and camel, secret fields under names, misplaced values in names and settings tables, a list under a settings table's path, a server named env), FuzzRedact's seeds under names and settings tables, and TestRestoreOlderNamesCopy for a VM copy an older devvm blanked, which devvm agent save leaves out with a warning (an After you upgrade line). Thanks to dhruv1220 for the tests' idea in #58. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your idea of matching secret words as whole words shaped the tests for the #55 fix, which is in 0.2.0-rc.1. Thanks again! |
Fixes #55.
Redactdecided a settings key held a secret by substring-matching its nameagainst
key,token,secretandpassw, so a whole table under a keylike
tokeneconomizercounted as secrets and every value under it becamedevvm-redacted. With the TokenEconomizer plugin installed that blankedextraKnownMarketplaces.tokeneconomizer.source.source("github"),marketplaces.tokeneconomizer.source_typeand the hook-trust entries, andClaude Code rejected the whole settings file — every plugin showed as
disabled in the VM.
A stem now only counts as a word of its own: at a camelCase or separator
boundary, at the key's end, or with a trailing
s(tokens,apiKeys).A stem starting a longer lowercase word doesn't count, so
tokeneconomizer,tokenizer,keystoreandkeyboardkeep their values, whileapiKey,apikey,oauth_token,accessToken,client_secret,password,passwd,tokensandAuthorizationstill redact exactly as before.internal/agentlogin/redact.go:redactName's substring regex is nowsecretKeyName/secretStemAt, with the same keep rules (paths,{env:X},true/false, short numbers, Claude Code's own env) untouched.internal/agentlogin/redact_test.go:TestRedactKeepsMarketplaceNamereproduces the issue's JSON and TOML settings (fails on the old code, passes
with the fix), plus a
TestSecretKeyNametable for the boundary cases.docs/content/docs/internals/network.md: the "Keys in settings files"bullet now says what counts as a secret-named key.
Verified:
go test ./internal/agentlogin/andgo test ./internal/structure/green,gofmt/go vetclean. The widergo test ./internal/...suite is green exceptTestScript/install, whichfails identically on unmodified code (its
install.shtest extracts atarball as non-root and
tarrefuses the chown) — a pre-existingenvironment failure, unrelated to this change. (
miseisn't available inthis environment, so the full
mise rungate couldn't run here.)