While in theory, this adds at least some small layer of protection, I have doubts that it adds anything meaningful to stop a smart attacker.
The problem here is that everything is running as your user, so it's all the same security sphere.
You may be thinking, "But Bitwarden requires me to approve each key request". Problem is that if the attacker is already running as your user, which I'm assuming here because to steal your bare keys, they'd already need to be. This means they can also hit the approve button for you.
Ok, now you say "But it requires touchID!". Maybe that gets you just a little bit of protection, but...
The next idea is to just steal the decrypted key out of RAM. This requires a little bit of effort, because you generally can't attach to a sibling process without root on Linux with default configs. This will only delay things slightly. Attaching to your child is allowed, so all an attacker needs to do is replace your launch shortcut/service for Bitwarden with a thin wrapper that makes the attacker the parent process, and then they can just ptrace it and steal the decrypted key next startup. On Mac, where the ptrace path isn't viable due to disallowing ptrace of signed binaries by default, you could just replicate the Bitwarden GUI as a wrapper and steal the master password at startup.
If you really want to protect your keys from attacks like this, you need a real hardware device with OOB signaling.
I’m currently trying to get to a point where I don’t keep long lived credentials on disk, and as much as possible keep them out of environment variables as well. I don’t want random processes running as my user account to be able to go sniff out my GitHub, AWS, and so on API tokens. Unfortunately It’s a massive pain to get right at the moment. I particularly don’t want long lived credentials where if a process sends them to a server somewhere they’re valid for ages afterwards.
SSH keys are pretty much solved, I’m using 1Password’s SSH agent similar to what OP is doing with Bitwarden. It works wonderfully.
Various API keys are a pain in the backside. 1Password has some features which kind of maybe help by allowing you to keep credentials in 1Password and then exposing them either as a named pipe that requires auth to read, or via CLI wrappers that inject the credentials at runtime. Both of those still require long lived credentials though.
At some point I’ll probably snap and build something analogous to what 1Password are doing but using OAuth or similar to request short lived, scoped, credentials as needed. I assume there’s approximately six hundred things like this which are targeted at agent use but I’d like something that doesn’t require me to run everything in a sandbox.
Why not just use the regular SSH agent with a password? Still encrypted on disk, so I don't see what the difference is.
I think the answer is more plainly and reasonably given in the article TFA cites as inspiration, "I deleted all my SSH keys":
> First – Isn’t using a passphrase enough? Probably. I don’t intend to imply that this post is the only way that anyone should be doing SSH keys. [...] So yes, the ’traditional’ method is probably fine for most threat models.
https://blog.infected.systems/posts/2026-11-03-i-deleted-all...
Typing a reasonably strong SSH key passphrase many times a day is deeply annoying, and the alternative to that is running ssh-add once a session and then anything else running as your user being able to use it with impunity.
Agents like Bitwarden and 1Password are more granular in their authorisation, in 1Password’s case I tap the fingerprint reader on my laptop when a process in a specific terminal first requests SSH key access to authorise that, after which it can use it as much as it likes until the session times out. Doing so however doesn’t mean that some other process spawned by some malware can also use it, that’s going to pop a prompt up again.
If your threat model includes rogue LLM agents on your system then your passphrase can be compromised by a logger or just getting it from memory
I use yubikey Fido keys so I need to touch the key to unlock it
It’s quite wild to be working and see my yubikey flash waiting for input because I have an agent running a task and it’s trying things like GitHub auth without asking me. Not hard to imagine it taking the next step and just grabbing tokens it needs to do whatever it needs to complete its task
Yeah I'm really curious why using a key passphrase is not an option for the author. Seems like it has everything they're looking for:
- Good ergonomics
- No private key sitting unencrypted on disk
Hell, isn't it even the default when using `ssh-keygen`? As in, it prompts you for a passphrase if you don't explicitly tell it not to?
Just to clarify your point for others; SSH private key files can already be encrypted with a passphrase. SSH will then prompt for the passphrase whenever the key is used. The standard SSH agent can optionally keep keys unlocked for a time period.
There's no need to reveal your unencrypted keys to Bitwarden or any other cloud service.
cat ~/.ssh/id_rsa | pbcopy
feels wrong. Unnecessary uses of cat.
`pbcopy < ~/.ssh/id_rsa`
I stopped fighting this war because the Cat version sort of follows the Subject-Verb-Object order in English, depending on how you think about the subject.