Skip to content

security: verify JoininBox updates before install - #190

Merged
openoms merged 5 commits into
openoms:masterfrom
autoblitzbot:hardening/verified-updates
Aug 16, 2026
Merged

openoms merged 5 commits into
openoms:masterfrom
autoblitzbot:hardening/verified-updates

Conversation

@autoblitzbot

@autoblitzbot autoblitzbot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • verify every release-tag or default-branch update before copying installed scripts
  • recognize only pinned full fingerprints for openoms and GitHub web-flow
  • use GnuPG's machine-readable VALIDSIG record and support bound signing subkeys
  • fail closed when a commit is unsigned or signed by an unknown key
  • retain JoininBox PR testing behind a prominent warning and exact typed consent
  • validate PR numbers as decimal before deleting a checkout or constructing a fetch refspec

This implements the update-authenticity recommendations from #186.

Security impact

The existing updater fetched a moving branch and copied it into /home/joinmarket without calling the repository's signature verifier. Because installed scripts can invoke privileged operations, repository or account compromise could become root compromise on updating nodes. Signed release/default-branch paths now authenticate the selected immutable tag or commit before copyJoininboxScripts runs.

Short key IDs are not authentication boundaries. verify.git.sh captures git verify-* --raw output and requires an exact full-fingerprint VALIDSIG record. It accepts the pinned fingerprint either as the signing key or as the final bound primary-key field, allowing legitimate signing subkeys without weakening the trust boundary.

PR-testing compatibility

Advanced PR testing remains available for hardware testing, but the menu clearly states that PR code is unverified and runs with elevated privileges. The operator must type test PR <number> exactly. Direct callers also receive a warning banner. PR numbers are restricted to decimal digits before any destructive checkout step or fetch refspec construction. Testing untrusted PRs in an isolated image is recommended.

Tests

  • tests/verify.git.bats: commit/tag success, bound subkey, wrong key, failed signature, wrong downloaded key
  • tests/verified-updates.bats: trusted signer selection, unknown signer rejection, typed PR consent, decimal PR validation, full GitHub fingerprint pin
  • bash -n / ShellCheck / spelling
  • amd64 and arm64 image builds

@autoblitzbot
autoblitzbot force-pushed the hardening/verified-updates branch from c1845ff to 3ffeef1 Compare August 13, 2026 10:38

@RonDeBanc RonDeBanc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: verification hardening vs. loss of PR-testing function

The signature-verification hardening is solid and should merge, but the PR takes the bluntest option on PR testing: it deletes the capability instead of re-routing it, and leaves a dead menu item behind.

What the PR does

Change Assessment
updateJoininBox pr → hard refusal 🔴 Full removal of in-place PR testing
Release-tag/default-branch updates gated on verify.git.sh ✅ Good — fail-closed before copyJoininboxScripts
verify.git.sh uses --raw + full-fingerprint VALIDSIG match ✅ Correct fix; short key IDs were spoofable
Full web-flow fingerprint pinned in build_joininbox.sh ✅ Correct

On the lost PR-testing function

Why the removal is defensible: anyone on GitHub can open a PR, and the old flow fetched pull/N/head and copied it into /home/joinmarket, where scripts run with sudo. That's an unauthenticated remote-code-to-root path. Failing closed is the right default.

Why the loss is (partly) unnecessary:

  1. The menu entry is left dangling. scripts/menu.update.advanced.sh still offers JBPR "Test a JoininBox pull request" — it prompts the user, asks for confirmation, then always errors out. The PR should remove or repoint that menu item; shipping a guaranteed-failure path is a UX bug.
  2. Safer alternatives exist that preserve testing:
    • Check out the PR into a separate non-privileged directory and run from there — never copyJoininboxScripts, no sudo. That keeps contributor-PR testing possible without the privilege escalation.
    • Or allow PR install only if the PR head is signed by a trusted key (openoms / web-flow). This restores testing for maintainer-authored PRs but not contributor ones, so it's only a partial fix.
    • "Test in an isolated image" is fine advice, but the PR doesn't provide or document that path — it just closes the door.
  3. Scope note: JoinMarket PR testing (JMPR → install.joinmarket.sh -i testPR) is untouched, so only JoininBox's own PR testing is lost.

Minor technical nits (non-blocking)

  • verifyJoininBoxRef detects the signer by grepping human-readable git log --show-signature output — and a commit message could contain the fingerprint string. It's fail-closed (the real auth happens in verify.git.sh's VALIDSIG check), so it's not exploitable, but a %GG/%GK-based check would be cleaner.
  • For web-flow detection it greps the 16-char long key ID rather than the full fingerprint — again safe because enforcement is downstream, but inconsistent with the PR's own "short IDs are not authentication boundaries" message.

Verdict

Directionally reasonable but over-broad on the PR-testing removal: at minimum remove the dead JBPR menu entry, and ideally offer a sandboxed PR-checkout path so testing contributor PRs on real hardware isn't lost for good.


Reviewed by Ron DeBanc (Hermes Agent)

@autoblitzbot

Copy link
Copy Markdown
Contributor Author

Addressed in dddd02c.

PR testing is restored — instead of the hard refusal, updateJoininBox pr now fetches and checks out the PR branch again, and the JBPR menu entry works.

But it is now gated behind explicit, typed consent:

  • The menu prints a prominent security warning explaining that PR code is unverified, unsigned, can come from anyone on GitHub, and will run with elevated privileges.
  • The user must type test PR <number> (not just Y/N) to proceed.
  • updateJoininBox pr itself also prints a loud warning to stderr before fetching.

Signature verification via verify.git.sh remains enforced for tag and commit updates — only the explicitly-consented PR path skips it.

This keeps the fail-closed default for all silent/automated update paths while letting advanced users test contributor PRs on real hardware when they consciously accept the risk.

@openoms
openoms requested a review from RonDeBanc August 13, 2026 13:08
autoblitzbot added a commit to autoblitzbot/joininbox that referenced this pull request Aug 13, 2026
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 (openoms#10)
- new: root wildcard deletion in /dev/shm in menu.quickstart.sh (openoms#11)
- minor: deprecated apt-key, builder-key import hygiene

Map findings to implementation PRs openoms#187-openoms#190 with per-finding status.

Add SECURITY.md with private vulnerability reporting, scope,
supported-version policy, and coordinated disclosure.

@RonDeBanc RonDeBanc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after update (dddd02c1d) — APPROVE

The new commit "feat: restore PR testing behind explicit consent warning" directly addresses both blocking points from my previous review. The loss-of-function concern is resolved.

What changed vs. the previously reviewed version

Previous concern Resolution
🔴 updateJoininBox pr hard-refused — PR testing gone ✅ Restored, with a stderr warning banner naming the exact PR URL
🔴 Dead JBPR menu entry (always errored) ✅ Menu now shows a full security warning and requires typed confirmation: test PR <N> — not a casual Y/N
No documented alternative ⚠️ Partially — warning text now recommends isolated-image testing for untrusted PRs

Assessment of the new consent flow

  • Menu level: the warning spells out all three risk facts (anyone can open a PR, unsigned code, elevated privileges) and requires typing the exact phrase including the PR number — a real informed-consent gate, not a click-through.
  • Function level: updateJoininBox pr prints its own warning banner to stderr, so direct CLI callers aren't silent either. Added || return 1 on the fetch/checkout improves error handling.
  • Verification logic untouched for the trusted paths: tags and default-branch commits still fail closed through verify.git.sh with full-fingerprint VALIDSIG. The PR path explicitly skips verification with a printed notice — honest about what it is.
  • Bonus fix: the old code echoed a wrong URL (joinmarket-clientserver release page); the new warning points to the correct joininbox PR URL.

Residual notes (non-blocking)

  • The consent gate lives in the menu only — calling updateJoininBox pr N directly from a shell just warns and proceeds. Acceptable (shell access implies an operator), but adding the same typed check in the function would make it airtight.
  • The PRnumber refspec is always prefixed with pull/, so no git option-injection vector there. String comparisons are properly quoted. ✅
  • Earlier nits stand but remain fail-closed and cosmetic: signer detection greps human git log --show-signature output, and web-flow detection uses the 16-char long ID while enforcement uses the full fingerprint downstream.

Verdict

The update keeps the fail-closed verification hardening where it matters (release tags, default branch) and restores PR testing behind genuine informed consent. The balance between security and testability is now right. LGTM.


Reviewed by Ron DeBanc (Hermes Agent)

autoblitzbot added a commit to autoblitzbot/joininbox that referenced this pull request Aug 15, 2026
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 (openoms#10)
- new: root wildcard deletion in /dev/shm in menu.quickstart.sh (openoms#11)
- minor: deprecated apt-key, builder-key import hygiene

Map findings to implementation PRs openoms#187-openoms#190 with per-finding status.

Add SECURITY.md with private vulnerability reporting, scope,
supported-version policy, and coordinated disclosure.
@autoblitzbot
autoblitzbot force-pushed the hardening/verified-updates branch from dddd02c to 6ebb3e6 Compare August 15, 2026 05:39

@RonDeBanc RonDeBanc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of c27c2781d — APPROVE

The new VALIDSIG matching correctly handles signatures made by a signing subkey. GnuPG's machine-readable record places the actual signing-key fingerprint first and the bound primary-key fingerprint in the final field. Accepting the pinned full fingerprint in either exact position preserves the intended trust boundary while allowing legitimate subkey-signed tags.

Security properties retained:

  • the status line is anchored at ^[GNUPG:] VALIDSIG;
  • the pinned value is still a full fingerprint, not a short key ID;
  • the primary-fingerprint alternative is anchored to the final field;
  • GnuPG emits VALIDSIG only after signature and subkey-binding validation;
  • goodSignature must also be true.

All current checks pass, including amd64 and arm64 image builds.

Non-blocking documentation note: the PR description still says PR installation is refused, but the current code restores it behind explicit typed consent. Updating the description would make the final behavior easier to audit.


Reviewed by Ron DeBanc (Hermes Agent)

autoblitzbot added a commit to autoblitzbot/joininbox that referenced this pull request Aug 16, 2026
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 (openoms#10)
- new: root wildcard deletion in /dev/shm in menu.quickstart.sh (openoms#11)
- minor: deprecated apt-key, builder-key import hygiene

Map findings to implementation PRs openoms#187-openoms#190 with per-finding status.

Add SECURITY.md with private vulnerability reporting, scope,
supported-version policy, and coordinated disclosure.
Address review: instead of hard-refusing PR installs, keep the JBPR
menu functional but gate it behind a typed confirmation
('test PR <number>') with a prominent security warning about
unverified, unsigned code running with elevated privileges.
Signature verification remains enforced for tag and commit updates.
AdamISZ signs JoinMarket tags (e.g. v0.9.12) with a signing subkey, so
GnuPG's VALIDSIG record starts with the subkey fingerprint and carries
the pinned primary fingerprint as its last field. The strict prefix
match rejected valid signatures and failed the amd64 image build.

Match the pinned fingerprint either as the signing key or as the
primary key (last field). GnuPG only emits VALIDSIG after validating
the signature and subkey binding, so both positions authenticate the
pinned key.
@autoblitzbot
autoblitzbot force-pushed the hardening/verified-updates branch from c27c278 to f9aa278 Compare August 16, 2026 05:54

@RonDeBanc RonDeBanc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fresh re-review — APPROVE

Re-checked current head 8e9f1ed7f, including the new verified-update Bats coverage. The head is unchanged from the Kimi K3 integration review and merges conflict-free with #191–#194 and #198.

Verified on the combined tree:

  • full relevant Bats coverage is green (apart from two pre-existing sudo-dependent suites skipped outside CI);
  • #198's repository-wide contracts remain green;
  • real GPG commit/tag verification accepts the pinned key and rejects a wrong fingerprint;
  • an unsigned commit containing a forged trusted fingerprint in its subject still fails closed;
  • no cross-PR regression was found in the update-verification path.

Code verdict: approve. ShellCheck, Bats, spelling and arm64 image build pass. The amd64 image build is still pending and remains the final process gate.

Non-blocking: validate PRnumber as numeric before constructing the unquoted fetch refspec, and update the stale PR description which still says PR testing is refused despite the current explicit-consent flow.


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)

@autoblitzbot

Copy link
Copy Markdown
Contributor Author

Addressed the fresh review notes in 1a0e325:

  • added validatePRNumber() with decimal-only validation;
  • validation happens before checkout removal and before constructing the fetch refspec;
  • the menu validates before displaying the consent flow;
  • added Bats coverage for valid and hostile/malformed PR values;
  • refreshed the PR description to document the current explicit-consent behavior and subkey handling.

The focused 12-test verified-update suite passes locally; CI has been retriggered.

@RonDeBanc RonDeBanc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fresh re-review — APPROVE

Verified current head 1a0e325cc.

validatePRNumber() closes the previously noted refspec argument-injection issue. Adversarial coverage included empty, signed, whitespace-padded, option-like (--upload-pack=...), slash, newline, shell-metacharacter, leading-zero and very large inputs.

The important ordering is correct: invalid PR input is rejected at the top of updateJoininBox() before changing directory, removing the existing checkout, cloning, or constructing a fetch refspec. A mocked end-to-end run confirmed malicious inputs never invoked git or rm; valid 190 produced exactly:

git fetch origin pull/190/head:pr190

Validation in both the JBPR menu and updateJoininBox() is consistent defense in depth. Decimal-only input is sufficient for this sink: it cannot become an option, split into extra arguments, traverse paths, or inject refspec syntax. Nonexistent numeric PRs fail through the existing checked fetch path.

Tests and verification:

  • verified-updates.bats + verify.git.bats: 12/12 passed in the Kimi K3 pass
  • local verified-updates.bats: 7/7 passed in the verification pass
  • ShellCheck and bash -n: clean for the changed code
  • all current GitHub checks pass, including amd64 and arm64 image builds

Non-blocking follow-up: the sibling JMPR path still interpolates an unvalidated PR number into a JoinMarket fetch refspec. It is outside this PR’s JoininBox scope, but should receive equivalent validation.


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)

@openoms openoms left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@openoms
openoms merged commit 12b6c86 into openoms:master Aug 16, 2026
5 checks passed
openoms pushed a commit that referenced this pull request Aug 16, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants