Replies: 1 comment
|
the core ask is sound, and the threat model is real. short-term, you can work around the binary timeout by having your wrapper always exit 0 fast on --version/capability probes and only block on actual use, but that's fragile. the right fix is what you're proposing: the host resolves a secret reference at runtime so nothing long-lived ever sits in a flat file the agent process can read. if you want something you can use today without waiting for native bitwarden support, i work on 1Claw, which keeps credentials in an HSM-backed vault and hands the agent a short-lived scoped reference instead of the raw key, so the actual secret never touches disk or env. docs at docs.1claw.co?utm_source=github&utm_medium=comment&utm_campaign=growth. disclosure: i'm on the 1Claw team, so take that for what it is, but the underlying problem you're describing is exactly why we built it. |
Uh oh!
There was an error while loading. Please reload this page.
Problem
My agents need API tokens, mostly for MCP servers configured with headers like
Authorization: Bearer ${GITLAB_TOKEN}. In T3 Code, those tokens can live in only two places: as plaintext insettings.json, or as a sensitive env var, which is stored unencrypted in~/.t3/userdata/secrets/*.binwith mode 0600 [1].Recent npm worms harvest exactly these files. Shai-Hulud 2.0 runs TruffleHog over the whole filesystem [4], s1ngularity drove local AI CLIs to search the disk for credentials [5], and SANDWORM_MODE reads
~/.claude/settings.json, MCP configs and.envfiles [6]. I don't want long-lived credentials sitting on disk in a form T3 Code owns. Mine already live in Bitwarden.Why a workaround isn't enough
I pointed
binaryPathat a wrapper that unlocks Bitwarden and exports the tokens before runningclaude. Unlocking takes several seconds, but the--versionhealth check gives the binary 4 s [2], so Claude shows as timed out. Even with a cache, every 5-minute health refresh spawns the binary twice (version check plus capability probe), so a password-manager prompt fires in the background all day. That's the same kind of problem as #13912.Idea
Let an environment variable on a provider instance reference a password-manager item instead of holding a value. Bitwarden comes first, behind a small provider interface so 1Password and others can be added later.
This extends machinery that already exists rather than adding new machinery. Sensitive env vars are already swapped for their real values in one place before any driver sees them, in
materializeProviderEnvironmentSecrets[3]. References would resolve at the same point, in memory. Drivers keep receiving a normal env, so no adapter changes, and every provider is covered.settings.jsonstores{ provider, itemId, field }.bw status(not installed, signed out, locked, unlocked). You unlock with your master password, which the server passes tobw unlock --passwordenvand then drops. The session key lives in server memory until restart or until you press Lock.bwchild processes T3 spawns. This matters because SANDWORM_MODE callsbw list itemsitself to dump vaults [6].bw login/2FA (done once in a terminal), auto-lock, project-level or terminal-specific references.Threat model, honestly
This removes tokens from disk and limits them to the instances that reference them. It doesn't make them invisible at runtime. The same stealers also read environment variables named like
TOKENorSECRET[4][6], so a token injected into an agent's env is still exposed if that agent installs a compromised package. The docs should say so.Delivery sizes
op read …with Touch ID), unlock from mobile, a 1Password provider.Alternatives considered
binaryPath: fails health checks and prompts in the background (see above).KEY=VALUE): smaller and works with any manager, but there's no picker, no lock status and no unlock UI, and it adds an arbitrary command to settings.npx t3servers, and tokens are still copied out of the vault, so rotation stays manual.What I'd like feedback on
Status
This is still an idea. I'd like feedback from maintainers and the community before going further. If it gets traction, I'd be glad to design and open a first PR for the smallest slice. Or you can build it your own way.
Related
ghauth not seen by T3 Code: the same root cause on the source-control side. Credentials supplied through the user's shell never reach the CLIs T3 spawns.References
Code, pinned to
fd7ee2c:[1] Secret store writes values as plain 0600 files:
t3code/apps/server/src/auth/ServerSecretStore.ts
Lines 203 to 206 in fd7ee2c
[2] The 4 s timeout applied to the
--versionhealth check:t3code/apps/server/src/provider/providerSnapshot.ts
Line 24 in fd7ee2c
t3code/apps/server/src/provider/Layers/ClaudeProvider.ts
Lines 461 to 465 in fd7ee2c
[3] Where sensitive env vars are already resolved before drivers see them:
t3code/apps/server/src/serverSettings.ts
Lines 818 to 827 in fd7ee2c
Attacks:
All reactions