fix(keyconv): preserve verbatim keys for env/headers/defaultEnv (gh_token bug)#30
Conversation
transformKeys recursed into ALL nested maps, snake-casing the KEYS of fields
that hold user data — env var names, HTTP header names, workstation defaultEnv.
camelToSnake("GH_TOKEN")="gh_token", which the gh CLI never reads, so the
master gh SecureCLI silently failed auth (exit 4: 'populate the GH_TOKEN env
var'). Same corruption hit MCP headers + workstation env injection. The field
KEY still converts (encryptedEnv↔encrypted_env); its value map's keys don't.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesPassthrough key preservation in keyconv
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Root cause:
transformKeysrecursed into every nested map, snake-casing the KEYS of fields that hold user data.camelToSnake("GH_TOKEN")="gh_token"→ the master gh SecureCLI's token landed undergh_token, which the gh CLI never reads →exit 4: populate the GH_TOKEN environment variable. Same silent corruption affects MCPheadersand workstationdefaultEnv.Fix:
transformKeysno longer recurses into the value of passthrough fields (env,encryptedEnv/encrypted_env,headers,defaultEnv/default_env). The field key still converts; its value map's keys are verbatim. AddsTestKeyConv_PreservesPassthroughMapKeys. Prevents the whole class (any env/header credential).Summary by CodeRabbit