A secret too large for the locked-memory limit fails with an error, not a panic (closes #145)
check / check (push) Waiting to run
check / check (push) Waiting to run
secret add, import and generate secret crashed with memguard's panic once a value outgrew the locked-memory limit, and because the value was held twice, half the usual 8 MiB limit was enough. secret now raises the limit to the hard limit at startup. The value is read a page at a time into a memguard.Stream, which keeps it encrypted, then copied once into locked memory after its size is checked against 100 MiB and against the limit less 16 pages for the command's keys. It comes out of the stream through Next, not Read: Read re-encrypts a leftover piece, and memguard hangs if that runs out of locked memory. Judgement call: with a limit of 64 KiB or less, nothing can be stored. Model: opus-5-5
This commit is contained in:
@@ -18,6 +18,17 @@ https://git.eeqj.de/sneak/secret/milestone/12
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-14: A secret too large for the locked-memory limit (`ulimit -l`) makes
|
||||
`secret add`, `secret import` and `secret generate secret` fail with an error
|
||||
that names the limit, not crash with a panic
|
||||
(https://git.eeqj.de/sneak/secret/issues/145). memguard panics when it cannot
|
||||
lock memory, and the value was held twice, so with the usual 8 MiB limit any
|
||||
value over about 4 MiB crashed. `secret` now raises the limit to the hard
|
||||
limit at startup. The value is read a page at a time into a `memguard.Stream`,
|
||||
which keeps it encrypted, and copied once into locked memory only after its
|
||||
size is checked against 100 MiB and against the limit less 16 pages for the
|
||||
command's keys. `generate secret` checks the length before it generates
|
||||
anything.
|
||||
- 2026-10-14: A `secret add --force` that cannot unlock the vault, given a wrong
|
||||
passphrase or mnemonic, leaves the secret as it was
|
||||
(https://git.eeqj.de/sneak/secret/issues/136). The new version used to be
|
||||
|
||||
Reference in New Issue
Block a user