DEV Community

Vagebond
Vagebond

Posted on

Your keys are in plain files. Move them into the vault.

In the last post we showed that ignore rules and deny rules leave gaps. An agent that can read your home folder can read what lies there.

This is the follow-up. Find those files. Then move them.

Step 1: look for yourself

Start with a few plain commands. No tool needed.

ls ~/.ssh
cat ~/.aws/credentials
find ~ -name ".env" -not -path "*/node_modules/*" 2>/dev/null
grep -rl "BEGIN OPENSSH PRIVATE KEY" ~ 2>/dev/null
Enter fullscreen mode Exit fullscreen mode

Every line that prints something is a secret in a plain file. Any process that runs as you can read it. That includes an agent.

Step 2: run the import scan

Kluis has an import scan. It finds keys, passwords, seed phrases and KeePass databases in your files.

You see the list. You choose what goes into the vault.

Step 3: move them into the vault

Each secret becomes an entry. Every entry is an age file, so the format is open. Nothing is locked into Kluis.

Keys are kept in the Secure Enclave and never leave the Mac. Every read of a secret asks for Touch ID. For long work, a timed session starts after one Touch ID. An audit log records the reads.

Once an entry is in the vault, you can delete the plain copy yourself.

Step 4: give a secret to one command

kluis run gives a secret to one command. When the command ends, the secret is gone.

An agent can use a secret without reading it, limited by a policy. The key goes to the command, never back to the agent.

What Kluis is not

Kluis is a password vault for the Mac. It needs macOS 14 or later on Apple silicon. There is no account and no server. It is free.

Try it

Download the disk image, drag Kluis to Applications and open it. Setup takes one minute, with no account.

Then run the scan and see what lies in your home folder.

https://baken.vagebond.nl/r/HfNztE2d

Top comments (1)

Collapse
 
vinmay profile image
Vinmay Nair •

Interesting approach! I wonder if there's a way to control what an agent can do with a credential without limiting its ability to execute commands. Hiding the secret is useful, but knowing how it's being used seems just as important.