Passing age keys via stdin SOPS_AGE_KEY_FILE=/dev/stdin not working
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
Hi,
I want to load the age keys from a password safe (keepassxc) and pass them to sops via stdin
keepassxc-cli show -a password db.kdbx mykey | SOPS_AGE_KEY_FILE=/dev/stdin sops -d secret.yaml
but I'll get
Failed to get the data key required to decrypt the SOPS file.
Group 0: FAILED
xxx: FAILED
- | failed to create reader for decrypting sops data key with
| age: no identity matched any of the recipients
yyy: FAILED
- | failed to load age identities: failed to parse
| 'SOPS_AGE_KEY_FILE' age identities: no secret keys found
Recovery failed because the file was encrypted with a Shamir threshold of
1, but only 0 part(s) were successfully recovered, one for each successful
key group. In order for SOPS to recover the file, at least 1 groups have to
be successful. In order for a group to be successful, decryption has to
succeed with any of the keys in that key group.
Decryption works fine when I write the output from keepassxc-cli show -a password db.kdbx mykey into a file first and use the file path in SOPS_AGE_KEY_FILE
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the keepassxc-cli pipeline with SOPS_AGE_KEY_FILE=/dev/stdin, then compare it with the working file-path form. Trace the SOPS_AGE_KEY_FILE age-identity loading entry point and verify how stdin is read. Done means age keys supplied through stdin are parsed and decryption succeeds for the reported command, with a regression test if the existing test structure supports it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100