Repository navigation
security: stop accepting passwords via command-line arguments - #192
Conversation
… statuses New implementation PRs: - openoms#191 finding openoms#11 (root wildcard rm in /dev/shm) - openoms#192 finding openoms#8 (passwords via argv) - openoms#193 finding openoms#5 (shared default password) - openoms#194 finding openoms#10 (eval-based arg parsing) - openoms#195 finding openoms#2 (sourcing joinin.conf as code) Only finding openoms#1 (unrestricted sudo) remains without a PR — it needs the root-owned helper redesign tested on hardware first.
RonDeBanc
left a comment
There was a problem hiding this comment.
Review: APPROVE
Clean fix for finding #8, and I verified the caller compatibility claim: both call sites (menu.tools.sh PASSWORD entry and start.joininbox.sh setupStep<6) invoke set.password.sh with no arguments, so the argv refusal breaks nothing.
What looks good:
- Hard refusal of password-via-argv with a clear explanation of why (ps/history/logs) — good operator education.
dialoggated oncommand -vand[ -t 1 ], with aread -r -sfallback — the script now works over a bare SSH session without dialog.- Retry loop replaces the old recursive
sudo /home/joinmarket/set.password.shself-call — much cleaner. - The per-account password option (same-for-all as an explicit yes/no, defaulting to separate) is a genuine security improvement beyond the minimum fix.
- Temp file
chmod 600,clearTempwith shred/rm fallback,unsetof password variables, and the script now properly requires root (exit 1instead of bareexit).
Nits (non-blocking): the non-dialog retry loop has no clean cancel path other than Ctrl-C, and printf '%s' "$input" via command substitution strips trailing newlines (untypable here anyway). Neither matters in practice.
Reviewed by Ron DeBanc (Hermes Agent)
… statuses New implementation PRs: - openoms#191 finding openoms#11 (root wildcard rm in /dev/shm) - openoms#192 finding openoms#8 (passwords via argv) - openoms#193 finding openoms#5 (shared default password) - openoms#194 finding openoms#10 (eval-based arg parsing) - openoms#195 finding openoms#2 (sourcing joinin.conf as code) Only finding openoms#1 (unrestricted sudo) remains without a PR — it needs the root-owned helper redesign tested on hardware first.
77e4345 to
acf998b
Compare
… statuses New implementation PRs: - openoms#191 finding openoms#11 (root wildcard rm in /dev/shm) - openoms#192 finding openoms#8 (passwords via argv) - openoms#193 finding openoms#5 (shared default password) - openoms#194 finding openoms#10 (eval-based arg parsing) - openoms#195 finding openoms#2 (sourcing joinin.conf as code) Only finding openoms#1 (unrestricted sudo) remains without a PR — it needs the root-owned helper redesign tested on hardware first.
Secrets passed as argv leak via 'ps', shell history and systemd-cgtop.
- refuse any non-help argument with an explanatory error
- passwords are only collected interactively: dialog --passwordbox
as before, with a 'read -s' fallback (with confirmation) when
dialog is unavailable or stdout is not a TTY
- allow independent credentials per account ('joinmarket', 'root',
and 'pi' if present); reusing one password for all accounts is
now an explicit user choice
- keep the mktemp temp-file in /dev/shm (mode 600) with the
cleanup trap; clear it after every read
Fixes finding openoms#8 from SECURITY-HARDENING.md (see PR openoms#186).
acf998b to
68af9a9
Compare
RonDeBanc
left a comment
There was a problem hiding this comment.
Fresh re-review — COMMENT (non-blocking EOF issue)
Current head df1945f48 remains code-approved and all GitHub checks pass. The new Bats coverage and combined master + #190–#194 + #198 integration suite are green.
One carried-over failure-path issue was independently reproduced: the non-dialog path of promptPassword() busy-loops when stdin reaches EOF. readSecret() ignores read's nonzero status; EOF therefore produces an empty value, the empty-password check retries, and the loop immediately hits EOF again.
Using the PR's fixture approach (root guard stubbed and chpasswd mocked), truncated input produced roughly 247 KB of repeated "Password cannot be empty" output in five seconds and required timeout to terminate it. tests/set.password.bats supplies complete input in all cases, so this path remains untested.
Suggested follow-up:
read -r -s -p "$1" input || return 1Propagate that failure from promptPassword() and add a Bats case with truncated stdin. This is not a merge blocker because the script is explicitly interactive-only and the dialog path handles cancellation correctly, but it should be tracked.
Primary review model: Kimi K3 (kimi-k3, Kimi Coding provider)
GitHub-state verification: Ron DeBanc using GPT-5.6 Sol (gpt-5.6-sol, OpenAI Codex provider)
|
Addressed the EOF issue in
All 6 focused password tests pass locally; CI has been retriggered. |
RonDeBanc
left a comment
There was a problem hiding this comment.
Fresh re-review — APPROVE
Verified current head 163ed009f.
The EOF busy-loop reported in the previous review is fixed. readSecret() now propagates failed reads; promptPassword() cancels on failure; and both top-level callers propagate the failure with exit status 1.
EOF was tested at the initial yes/no interaction, first password, confirmation, start of the per-account flow, and later in the per-account flow. Results:
- no busy-loop; all cases exited promptly with status 1;
- first-password and confirmation EOF caused no password writes;
- partial input without a trailing newline was discarded rather than accepted;
- cancellation was emitted on stderr and secrets were not exposed on stdout;
- no stale
/dev/shmtemporary file remained; - command-substitution status propagation works because locals are declared separately from assignment;
- the successful password-change paths remain green.
The baseline reproduces the original failure and requires timeout to terminate, confirming this patch fixes the reported behavior rather than merely changing its test.
Tests and verification:
set.password.bats: 6/6 passed independently and in the Kimi K3 pass- ShellCheck and
bash -n: clean - all current GitHub checks pass, including amd64 and arm64 image builds
Non-blocking residuals:
- EOF at
askYesNo()is interpreted as “No” and then reported as closed at the first password prompt. This is safe but could be made more direct. - In separate-password mode, EOF after an earlier account was updated leaves that account changed while later accounts remain unchanged. This is pre-existing sequential behavior; consider collecting all intended passwords before applying them, or warning that completion was partial.
Primary review model: Kimi K3 (kimi-k3, Kimi Coding provider)
Verification and GitHub-state model: GPT-5.6 Sol (gpt-5.6-sol, OpenAI Codex provider)
* docs: add security hardening plan * docs: re-scan findings, link implementation PRs, add SECURITY.md Re-verified all findings against the current default branch (16fc83f): - all 9 original findings still present - new: eval-based argument parsing in install.joinmarket.sh (#10) - new: root wildcard deletion in /dev/shm in menu.quickstart.sh (#11) - minor: deprecated apt-key, builder-key import hygiene Map findings to implementation PRs #187-#190 with per-finding status. Add SECURITY.md with private vulnerability reporting, scope, supported-version policy, and coordinated disclosure. * docs: link implementation PRs #191-#195, update finding statuses New implementation PRs: - #191 finding #11 (root wildcard rm in /dev/shm) - #192 finding #8 (passwords via argv) - #193 finding #5 (shared default password) - #194 finding #10 (eval-based arg parsing) - #195 finding #2 (sourcing joinin.conf as code) Only finding #1 (unrestricted sudo) remains without a PR — it needs the root-owned helper redesign tested on hardware first. * docs: fold hardening principles into SECURITY.md, drop addressed plan The staged hardening plan in SECURITY-HARDENING.md has been implemented through PRs #187-#195 (finding #1's scoped-helper migration is tracked separately), so the standalone plan document is removed. SECURITY.md now carries the durable content: the threat model, the design principles the codebase follows (least privilege, config-as-data, fail-closed authenticity, secret handling, boundary validation, unique first-boot credentials, defense in depth, safe failure), and the review methods and regression expectations for future security work. * docs: address review — split implemented controls from target principles Addresses RonDeBanc's re-review: - Private vulnerability reporting is now enabled on the repository. - Restructured into Implemented controls (verified on the default branch), Target design principles (normative direction), and Known limitations. Exact behavioral claims now match the implementation (sourceConf character rejection, verify-before-install, tor --verify-config, mktemp credential files, allowlisted service inputs, ShellCheck + Bats CI). - Restored unresolved work as known limitations: unrestricted NOPASSWD sudo, shared default password until #193 lands, moving-branch bootstrap (README/FAQ), default-GnuPG-home key imports, partial sandboxing and missing provenance/scanning. - Review methods now distinguish the 2026-08 review, current CI, and planned additions. --------- Co-authored-by: autoblitzbot <autoblitzbot@users.noreply.github.com>
Summary
Fixes finding #8 from
SECURITY-HARDENING.md(see PR #186):scripts/set.password.shaccepted a plaintext password as$1. Secrets in argv leak viaps, shell history, and systemd-cgtop. The script also set the same password on multiple accounts (joinmarket,root,pi).What changed
scripts/set.password.sh (only file touched):
-h/-helpnow exits with an error explaining that secrets are never accepted as command-line arguments. The help text no longer documents a password parameter.dialog --passwordboxflow (with confirmation) remains the primary path. Ifdialogis unavailable or stdout is not a TTY, the script falls back toread -swith a confirmation prompt. Passwords are never echoed.joinmarket,root, andpiwhen present) gets its own prompted password, each with confirmation.mktemp -p /dev/shm/(verified mode 600, not world-readable) with thetrap ... EXITcleanup; the file is additionallyshreded after every read andchmod 600is applied defensively.start.joininbox.shandmenu.tools.shinvokeset.password.shwith no arguments, so they need no changes.build_joininbox.shis intentionally untouched (covered by a separate first-boot credentials PR).Test plan
bash -n scripts/set.password.sh→ syntax OK (shellcheck not available in this environment; no new constructs beyond POSIX-ish bash already used in the repo)./etc/shadowmtime verified unchanged — nothing was modified. (Refusal happens before the root check, sosudo bash scripts/set.password.sh secretpwrefuses identically without changing anything.)read -spath) exercised with piped input: same-for-ally/Nprompt works; mismatch → re-prompt, too-short → re-prompt, empty → re-prompt, then a valid matching pair is accepted; passwords never appear in output.--insecure --passwordbox+ confirmation flow as before), to be verified on a live JoininBox install.