Repository navigation
security: replace eval-based argument parsing in installer - #194
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
Textbook remediation of finding #10:
valid_var_namegates every dynamic name against^[a-zA-Z_][a-zA-Z0-9_]*$before use.printf -v "${1}" '%s' "${value}"replacesevalfor writes;${!name}replaceseval var='$'…for reads. No user-controlled string is ever re-parsed as code.reject_shell_syntaxfails closed on[;&|$\<>]` in values — appropriate for this installer's value domain (versions, booleans, paths, hostnames), and the error names the offending input.
I traced the value shapes flowing through assign_value/range_argument (qtgui 0/1/true/false, version strings, user names) — none legitimately contain the rejected characters, so this hardens without breaking the supported install matrix.
Suggestion (non-blocking): add a case to the shellcheck/CI matrix that exercises the installer with hostile args (e.g. --version 'v0.9.11$(touch /tmp/x)') and asserts no file appears — cheap regression test proving the eval is really gone.
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.
6879575 to
a2ed78f
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.
a2ed78f to
6b04ddb
Compare
RonDeBanc
left a comment
There was a problem hiding this comment.
Fresh re-review — APPROVE
Re-checked current head c37577b80, including the hardened installer argument-parsing Bats suite, on a combined master + #190–#194 + #198 integration tree. The merge is conflict-free and the complete relevant test suite remains green.
The security boundary remains correct: dynamic variable names are validated, writes use printf -v, reads use indirect expansion, and user-controlled values are never passed through eval or re-parsed as shell code.
All current GitHub checks pass: ShellCheck, Bats, spelling, amd64 image build and arm64 image build. LGTM.
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)
* 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 #10 from the security hardening plan (SECURITY-HARDENING.md, see PR #186):
scripts/install.joinmarket.shusedevalfor CLI argument parsing.assign_value()raneval "${1}"="\"${value}\""— a crafted option value like--install '$(id)'executed arbitrary shell commands.range_argument()raneval var='$'"${1}"on the variable name — a crafted name also executed arbitrary shell.This is particularly dangerous because the script performs privileged (
sudo) operations.What changed
assign_value(): validates the target variable name against^[a-zA-Z_][a-zA-Z0-9_]*$](rejects otherwise viaerror_msg), rejects values containing shell metacharacters (;&|```$` `<` `>`), then assigns safely with `printf -v "$name" '%s' "$value"` — no `eval`, no interpretation of the value.range_argument(): validates the name the same way, then reads via indirect expansion${!name}instead ofeval.valid_var_name()/reject_shell_syntax()fail closed with a clearerror_msg.0/1 → false/truemapping, range validation, defaults all preserved). Calls happen at top level, soprintf -vassigns globals exactly asevaldid.Other
evalusage in the repo:grep -rn 'eval 'finds no other eval on caller-controlled input — this was the only file (left untouched per PR scope: SECURITY-HARDENING.md / SECURITY.md not modified).Test plan
bash -npasses. A throwaway harness (in /tmp, not committed) sources the patched helpers and ran 15 checks, all passing:assign_value install update,0/1 → false/truemapping, dash-stripping (--bob→bob),get_arg version -v v0.9.12,range_argumentaccepts valid / rejects invalid values, indirect read${!name}correct.x;touch /tmp/pwned,a$(touch /tmp/pwned)$(touch /tmp/pwned),`touch /tmp/pwned`,a$(reboot); touch /tmp/pwned,x;touch /tmp/pwned--install '$(touch /tmp/pwned)'→Invalid characters in: '$(touch /tmp/pwned)', no file created--install=update --qtgui=1 --user=bob→ parses and proceeds normally--install bogus→Option '--install' cannot be 'bogus'! It can only be: install config update testPR commit.shellcheck is not installed in this environment; no new constructs were introduced that change existing warning classes.