fix(#3): cleanup keychain tmpdir on shell exit - #3
Conversation
|
Independent review — 2026-09-04 Findings on PR #31. Shell injection in
|
|
Deep-review pass addendum — 2026-09-04 Verified on branch
|
src/credentials/keychain.ts renderUseScript emitted a tmpdir under
${TMPDIR:-/tmp}/keychain.XXXXXX with no removal hook. Decrypted credentials
persisted past the consuming shell command and were only reaped by the OS tmp
reaper (or never), exposing secrets to other processes on shared hosts.
Add 'trap "rm -rf "$__kc_dir" EXIT' to the generated script so the temp dir
is removed as soon as the consuming shell exits, even on error or signal.
Refs: Jackallink/qm-integration#3
9874b29 to
558b272
Compare
|
Amended — 2026-09-04 (addresses deep-review F3.2)
F3.1 (f.path not shell-quoted) intentionally left for v6 as a P1 sibling issue — out of this PR's scope. |
Closes: Jackallink/qm-integration#3
src/credentials/keychain.tsrenderUseScriptemitted a tmpdir under ${TMPDIR:-/tmp}/keychain.XXXXXX with no removal hook. Decrypted credentials persisted past the consuming shell command and were only reaped by the OS tmp reaper (or never), exposing secrets to other processes on shared hosts.Add
trap 'rm -rf "$__kc_dir"' EXITto the generated script so the temp dir is removed as soon as the consuming shell exits, even on error or signal.Affected tests
Reviewer checklist