Repository navigation
security: constrain generated wallet service inputs - #189
Conversation
074dbde to
cee2f1a
Compare
RonDeBanc
left a comment
There was a problem hiding this comment.
Review: request changes
The hardening direction looks good and the happy path remains operational, but I found one failure-path regression.
Blocking
scripts/start.service.sh:9-32: the new validation exits can run aftermenu_MAKER/passwordToFilehas created/dev/shm/.pw, but before the cleanup atscripts/start.service.sh:99.menu_MAKERalso does not checkstart.service.sh's exit status, so a rejected wallet leaves the password file behind while the menu continues as if the Yield Generator started.
Suggested fix: validate/canonicalize before prompting for the password, or make menu_MAKER quote the wallet arg, check start.service.sh's status, and shred /dev/shm/.pw on failure.
Verified
bash -n scripts/start.service.shbash -nacross all 61*.shscriptsgit diff --check origin/master...HEAD- sandboxed valid/invalid wallet cases, including generated unit content for
RPCoverTor=off/on - GitHub checks at review time: Shellcheck pass, Typos pass, image builds pending
| echo "# Making sure $script is not running" | ||
| sudo systemctl stop $script | ||
| sudo systemctl disable $script | ||
| if [ "$script" != "yg-privacyenhanced" ]; then |
There was a problem hiding this comment.
These new early exits can happen after menu_MAKER has already created /dev/shm/.pw via passwordToFile, but before the cleanup at the end of this script. Since menu_MAKER does not check this script's exit status, a rejected wallet leaves the password file behind and the menu still reports the YG as started. Please either validate before passwordToFile, or handle failure in menu_MAKER by shredding /dev/shm/.pw and aborting the start flow.
|
@RonDeBanc Thanks for the catch — both issues addressed in 6a62ebb. What changed: a) Validation extracted and moved to the top — the service/wallet checks now live in a shared wallet=$(validateServiceArgs "$script" "$walletInput") || exit 1b) Test evidence (sandboxed harness stubbing
|
6a62ebb to
3c171a2
Compare
RonDeBanc
left a comment
There was a problem hiding this comment.
Re-review of 3c171a22d — APPROVE
The update resolves the failure-path blocker from my previous review:
- ✅
menu_MAKERnow validates and canonicalizes the service/wallet inputs beforepasswordToFilecreates/dev/shm/.pw. - ✅ The canonical path is quoted when passed to
start.service.sh. - ✅
start.service.shindependently revalidates at entry, beforestopYGor any system change, so direct callers remain protected. - ✅
menu_MAKERnow checks the start command's status; on failure it reports the error and shreds any password file left behind. - ✅
systemctl daemon-reloadis called after generating the unit and before enabling/starting it.
I also rechecked the injection boundary: script is a single fixed allowlisted value, walletPath is fixed in _functions.sh, the canonical wallet must be a regular non-symlink file directly inside that directory, and the filename character allowlist excludes shell separators and whitespace. The generated unit filename and /bin/sh -c content therefore no longer receive attacker-selected command syntax through these arguments.
Minor UX nit (non-blocking): walletFileName is no longer assigned but is still referenced by the display-only echo, so the preview omits the wallet name. The actual startScript correctly uses the canonical $wallet and is unaffected.
Current checks: ShellCheck and spelling pass; image builds pending. The security fix and original failure path are good to merge.
Reviewed by Ron DeBanc (Hermes Agent)
…ilures Addresses review: validation exits could strand /dev/shm/.pw and menu_MAKER ignored start.service.sh's exit status.
3c171a2 to
3305745
Compare
Summary
yg-privacyenhancedprogramThis addresses the command/unit injection finding documented in #186 while retaining the existing Yield Generator startup flow.
Security impact
start.service.shpreviously accepted arbitrary program names and paths, interpolated them into/bin/sh -c, a systemd unit, and a root-controlled unit filename. An attacker able to influence those arguments could inject commands or make privileged systemctl operations target unintended units. The script now has a single allowed program and requires a canonical regular wallet file directly below the expected wallet directory.Tests
bash -n scripts/start.service.shgit diff --checkThis can later be stacked with the private credential transport change in #187 to remove the remaining fixed
/dev/shm/.pwpath.