Put age identity keys into locked buffers through one function (closes #38)
check / check (push) Failing after 3s
check / check (push) Failing after 3s
secret.IdentityToLockedBuffer replaces the eight places that converted an age identity's String() to bytes for a locked buffer and left the string, which holds the private key, in ordinary memory. It moves the string's own bytes into the buffer, which overwrites them. The copies age makes while encoding the key remain; the function's comment says so. TODO.md drops these places from the 1.0 memory-security entry, along with its stale version.go reference. Model: opus-5-5
This commit was merged in pull request #104.
This commit is contained in:
@@ -25,6 +25,18 @@ Bring the repo into policy compliance in one commit:
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-04: An age identity's private key goes into a locked buffer
|
||||
through `secret.IdentityToLockedBuffer` everywhere
|
||||
(https://git.eeqj.de/sneak/secret/issues/38): the vault's long-term key
|
||||
when a passphrase, PGP, keychain or Secure Enclave unlocker is created,
|
||||
the new unlocker's own key, a new secret version's key, and the key
|
||||
`secret encrypt` generates. Before, each place converted the string age
|
||||
returns to bytes and left the string in ordinary memory. The function
|
||||
moves the string's own bytes into the buffer, which overwrites them; the
|
||||
copies age makes while writing the string remain, as its comment says.
|
||||
The 1.0 memory-security entry below no longer lists these places,
|
||||
`internal/cli/crypto.go` among them, nor `version.go:155`, which was
|
||||
`internal/secret/version.go`, not `internal/cli/version.go`.
|
||||
- 2026-10-04: `script/lint-darwin` (`make lint-darwin`) runs `go vet` and
|
||||
`golangci-lint` in docker on the code as a macOS build compiles it
|
||||
(`GOOS=darwin`), with cgo off
|
||||
@@ -331,11 +343,11 @@ Bring the repo into policy compliance in one commit:
|
||||
- Command injection: GPG key IDs passed unescaped to exec.Command
|
||||
(pgpunlocker.go:323-327); data.String() passed unescaped to the
|
||||
security command (keychainunlocker.go:472-476).
|
||||
- Memory security: age identity .String() creates unprotected
|
||||
copies (keychainunlocker.go:356, pgpunlocker.go:256,
|
||||
version.go:155); age secret key held in a plain string in
|
||||
cli/crypto.go:86,91,113; private keys exposed via buffer.Bytes()
|
||||
to GPGEncryptFunc and EncryptWithPassphrase.
|
||||
- Memory security: age writes an identity's private key out as a
|
||||
string in ordinary memory, and the copies it makes on the way stay
|
||||
there (`secret.IdentityToLockedBuffer` overwrites only the string
|
||||
itself); private keys exposed via buffer.Bytes() to GPGEncryptFunc
|
||||
and EncryptWithPassphrase.
|
||||
- Input validation: no maximum secret size (DoS).
|
||||
- Timing attacks: bytes.Equal passphrase compare (cli/init.go:
|
||||
209-216); non-constant-time public key compare (vault.go:95-100).
|
||||
|
||||
Reference in New Issue
Block a user