Severity: minor
A value that ends in a newline comes back one byte shorter from secret get, which the README does not mention; the workaround is secret import.
What happens: AddSecret removes exactly one trailing \n from stdin before storing, so printf 'a\n\n' | secret add x stores a\n and cat key.pem | secret add k stores the file without its final newline. secret import --source key.pem stores the bytes unchanged. README says for add only "Reads the secret value from stdin" and for get "outputs a secret value to stdout".
printf 'a\n\n' | secret add x; secret get x | wc -c # 2
secret import y --source <(printf 'a\n\n'); secret get y | wc -c # 3
(AddSecret), README "Secret Management", secret add and secret get.
Correct behaviour: the behaviour itself is intended (it makes echo value | secret add store value), so the README's secret add entry says that one trailing newline is dropped, that secret import stores the file exactly, and secret get says it writes the value with no trailing newline. Whether add should offer a way to keep the newline is a product decision; not recommended.
Definition of done
README documents the trailing-newline rule for add and the exact-bytes rule for import and get.
A test stores a value ending in two newlines through add and through import and checks the stored lengths (2 and 3), so the documented rule is pinned.
Model: fable-5-1
Severity: minor
A value that ends in a newline comes back one byte shorter from `secret get`, which the README does not mention; the workaround is `secret import`.
What happens: `AddSecret` removes exactly one trailing `\n` from stdin before storing, so `printf 'a\n\n' | secret add x` stores `a\n` and `cat key.pem | secret add k` stores the file without its final newline. `secret import --source key.pem` stores the bytes unchanged. README says for `add` only "Reads the secret value from stdin" and for `get` "outputs a secret value to stdout".
```
printf 'a\n\n' | secret add x; secret get x | wc -c # 2
secret import y --source <(printf 'a\n\n'); secret get y | wc -c # 3
```
Where: https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/secrets.go#L386 (`AddSecret`), README "Secret Management", `secret add` and `secret get`.
Correct behaviour: the behaviour itself is intended (it makes `echo value | secret add` store `value`), so the README's `secret add` entry says that one trailing newline is dropped, that `secret import` stores the file exactly, and `secret get` says it writes the value with no trailing newline. Whether `add` should offer a way to keep the newline is a product decision; not recommended.
**Definition of done**
- README documents the trailing-newline rule for `add` and the exact-bytes rule for `import` and `get`.
- A test stores a value ending in two newlines through `add` and through `import` and checks the stored lengths (2 and 3), so the documented rule is pinned.
Model: fable-5-1
sneak
was assigned by clawbot2026-10-13 00:39:03 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: minor
A value that ends in a newline comes back one byte shorter from
secret get, which the README does not mention; the workaround issecret import.What happens:
AddSecretremoves exactly one trailing\nfrom stdin before storing, soprintf 'a\n\n' | secret add xstoresa\nandcat key.pem | secret add kstores the file without its final newline.secret import --source key.pemstores the bytes unchanged. README says foraddonly "Reads the secret value from stdin" and forget"outputs a secret value to stdout".Where:
AddSecret), README "Secret Management",secret addandsecret get.Correct behaviour: the behaviour itself is intended (it makes
echo value | secret addstorevalue), so the README'ssecret addentry says that one trailing newline is dropped, thatsecret importstores the file exactly, andsecret getsays it writes the value with no trailing newline. Whetheraddshould offer a way to keep the newline is a product decision; not recommended.Definition of done
addand the exact-bytes rule forimportandget.addand throughimportand checks the stored lengths (2 and 3), so the documented rule is pinned.Model: fable-5-1