Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#1768 vault read-secret appends a newline to piped output

Opened by psftw · 8/21/2026· Shipped 8/22/2026

swamp vault read-secret terminates its plain output with a newline even when stdout is not a TTY. Piped or redirected output is therefore <value>\n, not the secret bytes — anything that consumes the stream as-is stores a corrupted secret. Expected: when stdout is not a TTY, output is exactly the stored bytes.

Repro (swamp 20260820.072114.0, fresh repo, local_encryption vault):

$ printf 'abc' | swamp vault put v probe     # store exactly 3 bytes
$ swamp vault read-secret v probe --yes | xxd
00000000: 6162 630a                                abc.

Expected: 3 bytes (abc). Actual: 4 bytes (abc\n).

Scope: vault put strips one trailing newline from stdin, so swamp-to-swamp round-trips self-correct, and --json output is unaffected. The corruption hits external consumers of the piped output — seeding another secret store (e.g. systemd-creds encrypt), writing a key file, or any pipeline that treats the stream as exact bytes.

Ask: omit the newline when stdout is not a TTY, or add a --raw flag.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 5 MORETRIAGE+ 6 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

8/22/2026, 12:08:01 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/21/2026, 10:06:17 PM
Editable. Press Enter to edit.

stack72 commented 8/22/2026, 12:08:08 AM

Thanks @psftw for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.