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:
@@ -127,6 +127,17 @@ one.
|
||||
|
||||
### Secret Management
|
||||
|
||||
#### Secret Size
|
||||
|
||||
A secret's value is held in locked memory, which is never written to swap.
|
||||
`secret` raises its locked-memory limit (`ulimit -l`) to the hard limit when it
|
||||
starts, and `secret add`, `secret import` and `secret generate secret` refuse a
|
||||
value that does not fit in that limit with 16 memory pages to spare (64 KiB with
|
||||
4 KiB pages), with an error that names the limit. Linux's usual limit of 8 MiB
|
||||
allows a value of nearly 8 MiB; a larger one needs a higher hard limit, such as
|
||||
`memlock` in `/etc/security/limits.conf`. No value may be over 100 MiB, whatever
|
||||
the limit.
|
||||
|
||||
#### `secret add <secret-name> [--force]`
|
||||
|
||||
Adds a secret to the current vault. Reads the secret value from stdin.
|
||||
|
||||
Reference in New Issue
Block a user