Repository navigation
Description
What happened
Security and stability hardening audit finding H02 / P2 (2026-09-28). Priority is an audit recommendation, not a claim of a production incident.
session-peer update --host pushes the standalone with base64 -d > "$D/session_peer.py", overwriting the installed program in place, and then reports updated: true without checking the version the new file reports.
In a synthetic HOME (remote script executed locally, no SSH), a truncated base64 stream left the installed file at 2,304 bytes. With a cleanly truncated stream the script exited 0; the truncated file ran --version with no output and exit 0, and update --host --json returned ok: true, updated: true, previous: 1.0.1, current: 1.0.2 with exit 0. With an invalid stream base64 -d exited 1 and the command failed, but the previous installation had already been replaced by the same 2,304-byte prefix.
Minor: update --host --check compares versions with !=, so a remote that is newer than the local client is reported as outdated ("1.0.3 → 1.0.2 available"), and a non-check update would push the older copy over it.
What you expected
Match the remote path of install.sh: decode into a same-filesystem mktemp staging file, verify that --version reports exactly the expected version, then atomically mv it into place. On any failure, keep the previous installation and report failure. Compare versions by order, not inequality.
Environment
- Baseline: published session-peer v1.0.2, commit
2046836822b88e53246de73851186598604cb5ec. - Reproduction: remote script from
push_to_remoterun withshunder a synthetic HOME;sshmocked inupdate --host. No host was contacted. - Audit environment: macOS arm64 (BSD
base64), Python 3.14.7, OpenSSH 10.3p1. - No live message tests or production mutation.
Source evidence
- session_peer_core/ssh.py#L244-L252 — in-place decode, version failure masked
- session_peer_core/ssh.py#L273-L275 — empty output becomes "unknown"
- session_peer_core/updates.py#L498-L512 — equality check,
updated: Truewithout verification - session_peer_core/updates.py#L482-L493 —
--checkuses!= - install.sh#L211-L221 — staged and verified remote install for comparison
Acceptance criteria
- Fixtures for truncated stream, invalid base64, interrupted transfer, invalid artifact and success.
- On failure the previous file and
~/.local/bin/session-peerlink remain usable; only owned staging files are removed. -
updated: trueonly when the installed copy reports exactly the pushed version. -
--checkand update never report a newer remote as outdated or downgrade it without an explicit choice.
Scope and limitations
Target: v1.0.3 hardening work. This issue does not authorize a release or operating-service changes.
Related, not duplicates: #204 fixed install.sh but not this code path; #16 and #27 introduced and adjusted update --host.
Checked
- Searched existing issues for duplicates.
- Removed credentials, conversation contents, private paths and real device/session identifiers.
- Used isolated fixtures without weakening inbound permissions.
Activity