Compare commits

..

37 Commits

Author SHA1 Message Date
DuProcess be98fb8d91 Harden release artifact verification
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 01:03:16 -04:00
DuProcess 0125966d2a Drive SDK maintenance while receiving
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:58:54 -04:00
DuProcess 8b33a5d20b Retransmit stream controls in transport
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:51:09 -04:00
DuProcess bbf45db0f6 Retransmit stream window adjustments
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:43:39 -04:00
DuProcess d8cc462077 Retransmit stream close controls
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:37:30 -04:00
DuProcess 4954059c6e Retransmit stream EOF controls
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:32:19 -04:00
DuProcess b1cc6bf8ae Reset terminal modes before snapshot repaint
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:24:45 -04:00
DuProcess bf50b38ce2 Support stream EOF half closes
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:20:52 -04:00
DuProcess dccd648ac9 Handle overlapping stream receive chunks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-13 00:05:30 -04:00
DuProcess 3ab314698b Split stream writes into packet chunks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:59:42 -04:00
DuProcess c4301f192c Bound stream receive reordering window
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:48:46 -04:00
DuProcess 7ebc6533a7 Reject trailing bytes in protocol packets
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:42:00 -04:00
DuProcess e67e06ebb5 Clear service decoders on oversized frames
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:37:47 -04:00
DuProcess fbedd54eaa Make 1.0 checks run full soaks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:34:22 -04:00
DuProcess 247a1669ce Align CI with release checks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:31:16 -04:00
DuProcess de179dd3e9 Run all-target tests in release gates
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:28:34 -04:00
DuProcess 7184b42b7a Reconnect before stale terminal input
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:25:43 -04:00
DuProcess 17cc1f6131 Parse bracketed IPv6 file endpoints
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:18:31 -04:00
DuProcess 4b82334e02 Adapt runtime stream retransmit pacing
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:11:25 -04:00
DuProcess b9d8b32ff1 Adapt stream retransmit pacing to RTT
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 23:00:53 -04:00
DuProcess 52a319fe9d Preserve restored screen during ticket reattach
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:54:39 -04:00
DuProcess 6bca98d1ce Default missing config fields on upgrade
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:45:05 -04:00
DuProcess ab256285d1 Align Windows client auth defaults
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:41:48 -04:00
DuProcess b076a84dc7 Reject unsafe Windows update cache segments
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:37:51 -04:00
DuProcess c0b9e17214 Harden Unix update source cache path
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:35:16 -04:00
DuProcess 0bc2a05586 Preserve restored screen through update reattach
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:32:04 -04:00
DuProcess c29c43d4db Reuse Windows update source cache
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:20:35 -04:00
DuProcess 6f055e9fc1 Use effective artifact tag in update checks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:13:36 -04:00
DuProcess 306a636e32 Mark RC Gitea releases as prereleases
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:09:19 -04:00
DuProcess a529061e58 Compare prerelease versions correctly for updates
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:05:21 -04:00
DuProcess 5a85e6508d Require checksums for prebuilt installers
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 22:00:01 -04:00
DuProcess efddd1544e Mark sessions empty on final client removal
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 21:55:50 -04:00
DuProcess 0a05c68e94 Arm wake repaint retry from input paths
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 21:51:02 -04:00
DuProcess 695f356411 Retry wake repaint after local sleep
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 21:47:02 -04:00
DuProcess fca1f9a08e Strip mouse reports unless a TUI owns them
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 21:42:17 -04:00
DuProcess 7f48af45cd Require complete release uploads by default
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 21:37:27 -04:00
DuProcess ae619c6a78 Skip stale latest prebuilts in installers
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
2026-07-12 21:34:25 -04:00
17 changed files with 4392 additions and 445 deletions
+7 -1
View File
@@ -15,8 +15,14 @@ jobs:
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- name: Format check - name: Format check
run: cargo fmt -- --check run: cargo fmt -- --check
- name: Shell syntax check
run: sh -n install.sh scripts/*.sh
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Test - name: Test
run: cargo test run: cargo test --all-targets
- name: TUI harness
run: sh scripts/tui-harness.sh
- name: Build release - name: Build release
run: cargo build --release run: cargo build --release
- name: Docker SSH benchmark gate - name: Docker SSH benchmark gate
+4 -4
View File
@@ -4,7 +4,7 @@ build:
cargo build --release cargo build --release
test: test:
cargo test cargo test --all-targets
fmt: fmt:
cargo fmt cargo fmt
@@ -16,18 +16,18 @@ release-check:
cargo fmt --check cargo fmt --check
sh -n install.sh scripts/*.sh sh -n install.sh scripts/*.sh
cargo clippy --all-targets -- -D warnings cargo clippy --all-targets -- -D warnings
cargo test cargo test --all-targets
$(MAKE) tui-harness $(MAKE) tui-harness
1.0-check: release-check reconnect-check hostile-network-check persistence-check package-check 1.0-check: release-check reconnect-check hostile-network-check persistence-check package-check
reconnect-check: reconnect-check:
cargo test --test integration_smoke resume_updates_udp_endpoint_for_roaming -- --nocapture cargo test --test integration_smoke resume_updates_udp_endpoint_for_roaming -- --nocapture
DOSH_SOAK_SECONDS=$${DOSH_SOAK_SECONDS:-300} cargo test --test integration_smoke sleep_roaming_soak_30m -- --ignored --nocapture DOSH_SOAK_SECONDS=$${DOSH_SOAK_SECONDS:-1800} cargo test --test integration_smoke sleep_roaming_soak_30m -- --ignored --nocapture
hostile-network-check: hostile-network-check:
cargo test --test hostile_network -- --nocapture cargo test --test hostile_network -- --nocapture
DOSH_BADNET_SOAK_SECONDS=$${DOSH_BADNET_SOAK_SECONDS:-300} cargo test --test hostile_network bad_network_tui_work_soak_30m -- --ignored --nocapture DOSH_BADNET_SOAK_SECONDS=$${DOSH_BADNET_SOAK_SECONDS:-1800} cargo test --test hostile_network bad_network_tui_work_soak_30m -- --ignored --nocapture
persistence-check: persistence-check:
cargo test --test integration_smoke session_survives_server_restart_same_shell_and_screen -- --nocapture cargo test --test integration_smoke session_survives_server_restart_same_shell_and_screen -- --nocapture
+192 -9
View File
@@ -11,6 +11,7 @@ param(
[string]$BinaryBase = $env:DOSH_BINARY_BASE, [string]$BinaryBase = $env:DOSH_BINARY_BASE,
[string]$BinaryName = $env:DOSH_BINARY_NAME, [string]$BinaryName = $env:DOSH_BINARY_NAME,
[string]$BinaryVersion = $(if ($env:DOSH_BINARY_VERSION) { $env:DOSH_BINARY_VERSION } else { "latest" }), [string]$BinaryVersion = $(if ($env:DOSH_BINARY_VERSION) { $env:DOSH_BINARY_VERSION } else { "latest" }),
[string]$UpdateCache = $(if ($env:DOSH_UPDATE_CACHE) { $env:DOSH_UPDATE_CACHE } else { Join-Path $HOME ".cache\dosh\source" }),
[switch]$BinaryRequired = $($env:DOSH_BINARY_REQUIRED -and $env:DOSH_BINARY_REQUIRED -ne "0"), [switch]$BinaryRequired = $($env:DOSH_BINARY_REQUIRED -and $env:DOSH_BINARY_REQUIRED -ne "0"),
[switch]$ForceConfig [switch]$ForceConfig
) )
@@ -100,14 +101,127 @@ function Release-LatestTagDownloadUrl {
return $null return $null
} }
function Version-Core($Value) {
$base = $Value.TrimStart("v").Split("+")[0]
$base.Split("-")[0]
}
function Version-Prerelease($Value) {
$base = $Value.TrimStart("v").Split("+")[0]
$dash = $base.IndexOf("-")
if ($dash -lt 0) {
return ""
}
$base.Substring($dash + 1).ToLowerInvariant()
}
function Version-Parts($Value) {
[regex]::Matches((Version-Core $Value), "\d+") | ForEach-Object { [int64]$_.Value }
}
function Compare-Prerelease($Left, $Right) {
if (-not $Left -and -not $Right) {
return 0
}
if (-not $Left) {
return 1
}
if (-not $Right) {
return -1
}
if ($Left -eq $Right) {
return 0
}
if ($Left -match "(?i)^rc(\d+)$" -and $Right -match "(?i)^rc(\d+)$") {
$leftRc = [int64]([regex]::Match($Left, "(?i)^rc(\d+)$").Groups[1].Value)
$rightRc = [int64]([regex]::Match($Right, "(?i)^rc(\d+)$").Groups[1].Value)
return $leftRc.CompareTo($rightRc)
}
return [string]::CompareOrdinal($Left, $Right)
}
function Compare-DoshVersion($Left, $Right) {
$leftParts = @(Version-Parts $Left)
$rightParts = @(Version-Parts $Right)
$width = [Math]::Max($leftParts.Count, $rightParts.Count)
for ($i = 0; $i -lt $width; $i++) {
$l = if ($i -lt $leftParts.Count) { $leftParts[$i] } else { 0 }
$r = if ($i -lt $rightParts.Count) { $rightParts[$i] } else { 0 }
if ($l -lt $r) { return -1 }
if ($l -gt $r) { return 1 }
}
return Compare-Prerelease (Version-Prerelease $Left) (Version-Prerelease $Right)
}
function Current-SourceVersion {
if (Test-Path "Cargo.toml") {
$raw = Get-Content "Cargo.toml" -Raw
} else {
$web = Repo-WebBase $Repo
if (-not $web) {
return $null
}
try {
$raw = (Invoke-WebRequest -UseBasicParsing -Uri "$web/raw/branch/main/Cargo.toml").Content
}
catch {
return $null
}
}
if ($raw -match '(?m)^version = "([^"]+)"') {
return $Matches[1]
}
return $null
}
function Latest-ReleaseTag {
$web = Repo-WebBase $Repo
if (-not $web) {
return $null
}
try {
$response = Invoke-WebRequest -UseBasicParsing -Uri "$web/releases/latest" -MaximumRedirection 5
$effective = $null
if ($response.BaseResponse.ResponseUri) {
$effective = $response.BaseResponse.ResponseUri.AbsoluteUri
} elseif ($response.BaseResponse.RequestMessage -and $response.BaseResponse.RequestMessage.RequestUri) {
$effective = $response.BaseResponse.RequestMessage.RequestUri.AbsoluteUri
}
$prefix = "$web/releases/tag/"
if ($effective -and $effective.StartsWith($prefix)) {
return $effective.Substring($prefix.Length)
}
}
catch {
return $null
}
return $null
}
function Latest-ReleaseIsStale {
if ($BinaryUrl -or $BinaryBase -or $BinaryVersion -ne "latest") {
return $false
}
$latest = Latest-ReleaseTag
$current = Current-SourceVersion
if (-not $latest -or -not $current) {
return $false
}
$latestVersion = $latest.TrimStart("v")
if ((Compare-DoshVersion $latestVersion $current) -lt 0) {
Write-Warning "latest release $latestVersion is older than source $current; skipping stale prebuilt"
return $true
}
return $false
}
function Verify-ArchiveChecksum($Url, $Archive) { function Verify-ArchiveChecksum($Url, $Archive) {
$checksumPath = "$Archive.sha256" $checksumPath = "$Archive.sha256"
try { try {
Invoke-WebRequest -UseBasicParsing -Uri "$Url.sha256" -OutFile $checksumPath Invoke-WebRequest -UseBasicParsing -Uri "$Url.sha256" -OutFile $checksumPath
} }
catch { catch {
Write-Warning "prebuilt checksum unavailable; continuing without sidecar verification" throw "prebuilt checksum unavailable; refusing unverified binary for $Url"
return
} }
$expected = ((Get-Content $checksumPath -Raw).Trim() -split "\s+")[0].ToLowerInvariant() $expected = ((Get-Content $checksumPath -Raw).Trim() -split "\s+")[0].ToLowerInvariant()
$actual = (Get-FileHash -Algorithm SHA256 $Archive).Hash.ToLowerInvariant() $actual = (Get-FileHash -Algorithm SHA256 $Archive).Hash.ToLowerInvariant()
@@ -155,11 +269,44 @@ function Install-Binary($Source, $Destination) {
} }
} }
function Normalize-PathForCompare($Path) {
[System.IO.Path]::GetFullPath($Path).TrimEnd(
[System.IO.Path]::DirectorySeparatorChar,
[System.IO.Path]::AltDirectorySeparatorChar
)
}
function Assert-NoRelativePathSegments($Path) {
foreach ($segment in ($Path -split '[\\/]')) {
if ($segment -eq "." -or $segment -eq "..") {
throw "refusing unsafe update cache path: $Path"
}
}
}
function Assert-SafeUpdateCache($Path) {
if (-not $Path) {
throw "refusing unsafe update cache path: $Path"
}
Assert-NoRelativePathSegments $Path
$full = Normalize-PathForCompare $Path
$root = Normalize-PathForCompare ([System.IO.Path]::GetPathRoot($full))
$homePath = Normalize-PathForCompare $HOME
$homeCache = Normalize-PathForCompare (Join-Path $HOME ".cache")
if ($full -eq $root -or $full -eq $homePath -or $full -eq $homeCache) {
throw "refusing unsafe update cache path: $Path"
}
$full
}
$bindir = Join-Path $Prefix "bin" $bindir = Join-Path $Prefix "bin"
$configDir = Join-Path $HOME ".config\dosh" $configDir = Join-Path $HOME ".config\dosh"
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
function Install-Prebuilt { function Install-Prebuilt {
if (Latest-ReleaseIsStale) {
return $false
}
$url = Release-LatestTagDownloadUrl $url = Release-LatestTagDownloadUrl
if (-not $url) { if (-not $url) {
$url = Release-DownloadUrl $url = Release-DownloadUrl
@@ -200,7 +347,6 @@ function Install-Prebuilt {
function Install-FromSource { function Install-FromSource {
Require-Command cargo Require-Command cargo
$tmp = $null
if (Test-Path "Cargo.toml") { if (Test-Path "Cargo.toml") {
$src = (Get-Location).Path $src = (Get-Location).Path
} else { } else {
@@ -208,9 +354,20 @@ function Install-FromSource {
throw "DOSH_REPO is required when running the installer from irm/iex" throw "DOSH_REPO is required when running the installer from irm/iex"
} }
Require-Command git Require-Command git
$tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("dosh-" + [guid]::NewGuid()) $sourceCache = Assert-SafeUpdateCache $UpdateCache
git clone --depth 1 $Repo $tmp | Out-Null $parent = Split-Path -Parent $sourceCache
$src = $tmp New-Item -ItemType Directory -Force -Path $parent | Out-Null
if (Test-Path (Join-Path $sourceCache ".git")) {
git -C $sourceCache remote set-url origin $Repo
git -C $sourceCache fetch --depth 1 origin main
git -C $sourceCache checkout -q -B main FETCH_HEAD
} else {
if (Test-Path $sourceCache) {
Remove-Item -Recurse -Force $sourceCache
}
git clone --depth 1 --branch main $Repo $sourceCache | Out-Null
}
$src = $sourceCache
} }
try { try {
@@ -222,9 +379,6 @@ function Install-FromSource {
} }
finally { finally {
Pop-Location Pop-Location
if ($tmp) {
Remove-Item -Recurse -Force $tmp
}
} }
} }
@@ -261,10 +415,38 @@ predict = true
predict_mode = "experimental" predict_mode = "experimental"
cache_attach_tickets = true cache_attach_tickets = true
credential_cache = "~/.local/share/dosh/credentials" credential_cache = "~/.local/share/dosh/credentials"
auth_preference = "native,ssh"
trust_on_first_use = false
native_auth_timeout_ms = 700
known_hosts = "~/.config/dosh/known_hosts"
identity_files = ["~/.ssh/id_ed25519"]
use_ssh_agent = true
forward_agent = false
escape_key = "^]" escape_key = "^]"
"@ | Set-Content -NoNewline -Encoding utf8 $clientConfig "@ | Set-Content -NoNewline -Encoding utf8 $clientConfig
} }
$hostsConfig = Join-Path $configDir "hosts.toml"
if ($ForceConfig -or -not (Test-Path $hostsConfig)) {
$defaultServer = if ($Server) { $Server } else { "user@example.com" }
$hostUdp = if ($DoshHost) { $DoshHost } else { $defaultServer }
@"
# Example:
# [server]
# ssh = "server"
# dosh_host = "server.example.com"
# port = 50000
# default_command = "tm"
# predict = true
[default]
ssh = "$defaultServer"
dosh_host = "$hostUdp"
port = $Port
predict = true
"@ | Set-Content -NoNewline -Encoding utf8 $hostsConfig
}
$userPath = [Environment]::GetEnvironmentVariable("Path", "User") $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if (-not (($userPath -split ';') -contains $bindir)) { if (-not (($userPath -split ';') -contains $bindir)) {
[Environment]::SetEnvironmentVariable("Path", "$userPath;$bindir", "User") [Environment]::SetEnvironmentVariable("Path", "$userPath;$bindir", "User")
@@ -281,5 +463,6 @@ Write-Host " $bindir\dosh.exe update --check"
Write-Host "" Write-Host ""
Write-Host "Client config:" Write-Host "Client config:"
Write-Host " $configDir\client.toml" Write-Host " $configDir\client.toml"
Write-Host " $configDir\hosts.toml"
Write-Host "" Write-Host ""
Write-Host "Open a new terminal for PATH changes to apply." Write-Host "Open a new terminal for PATH changes to apply."
+144 -8
View File
@@ -119,6 +119,37 @@ need() {
fi fi
} }
normalize_update_cache_path() {
case "$1" in
/*) printf '%s\n' "$1" ;;
*) printf '%s\n' "$(pwd)/$1" ;;
esac | sed 's#//*#/#g; s#/$##'
}
safe_update_cache_path() {
raw="$1"
if [ -z "$raw" ]; then
echo "refusing unsafe update cache path: $raw" >&2
exit 2
fi
case "$raw" in
"."|".."|./*|../*|*/.|*/..|*/./*|*/../*)
echo "refusing unsafe update cache path: $raw" >&2
exit 2
;;
esac
normalized="$(normalize_update_cache_path "$raw")"
home_norm="$(normalize_update_cache_path "$HOME")"
home_cache_norm="$(normalize_update_cache_path "$HOME/.cache")"
case "$normalized" in
""|"/"|"$home_norm"|"$home_cache_norm")
echo "refusing unsafe update cache path: $raw" >&2
exit 2
;;
esac
printf '%s\n' "$normalized"
}
ensure_cargo() { ensure_cargo() {
if command -v cargo >/dev/null 2>&1; then if command -v cargo >/dev/null 2>&1; then
return return
@@ -222,6 +253,113 @@ release_latest_tag_download_url() {
esac esac
} }
version_core() {
value="${1#v}"
value="${value%%+*}"
printf '%s\n' "${value%%-*}"
}
version_prerelease() {
value="${1#v}"
value="${value%%+*}"
case "$value" in
*-*) printf '%s\n' "${value#*-}" ;;
*) printf '\n' ;;
esac
}
version_core_part() {
version="$1"
index="$2"
version_core "$version" \
| sed 's/[^0-9][^0-9]*/ /g' \
| awk -v index="$index" '{ value=$index; if (value == "") value=0; print value }'
}
prerelease_less_than() {
left="$1"
right="$2"
if [ -z "$left" ] && [ -z "$right" ]; then
return 1
fi
if [ -z "$left" ]; then
return 1
fi
if [ -z "$right" ]; then
return 0
fi
if [ "$left" = "$right" ]; then
return 1
fi
left_rc="$(printf '%s\n' "$left" | sed -n 's/^[Rr][Cc]\([0-9][0-9]*\)$/\1/p')"
right_rc="$(printf '%s\n' "$right" | sed -n 's/^[Rr][Cc]\([0-9][0-9]*\)$/\1/p')"
if [ -n "$left_rc" ] && [ -n "$right_rc" ]; then
[ "$left_rc" -lt "$right_rc" ]
return
fi
first="$(printf '%s\n%s\n' "$left" "$right" | LC_ALL=C sort | sed -n '1p')"
[ "$first" = "$left" ]
}
version_less_than() {
left="$1"
right="$2"
for index in 1 2 3 4 5 6 7 8; do
lpart="$(version_core_part "$left" "$index")"
rpart="$(version_core_part "$right" "$index")"
if [ "$lpart" -lt "$rpart" ]; then
return 0
fi
if [ "$lpart" -gt "$rpart" ]; then
return 1
fi
done
prerelease_less_than "$(version_prerelease "$left")" "$(version_prerelease "$right")"
}
current_source_version() {
if [ -f Cargo.toml ]; then
sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | sed -n '1p'
return 0
fi
[ -n "$repo" ] || return 1
web_base="$(repo_web_base "$repo")" || return 1
curl -fsSL "$web_base/raw/branch/main/Cargo.toml" 2>/dev/null \
| sed -n 's/^version = "\(.*\)"/\1/p' \
| sed -n '1p'
}
latest_release_tag() {
[ -n "$repo" ] || return 1
web_base="$(repo_web_base "$repo")" || return 1
latest_url="$(curl -fsSL -o /dev/null -w '%{url_effective}' "$web_base/releases/latest" 2>/dev/null || true)"
case "$latest_url" in
"$web_base"/releases/tag/*)
tag="${latest_url##"$web_base"/releases/tag/}"
[ -n "$tag" ] || return 1
printf '%s\n' "$tag"
;;
*)
return 1
;;
esac
}
latest_release_is_stale() {
if [ -n "$binary_url" ] || [ -n "$binary_base" ] || [ "$binary_version" != "latest" ]; then
return 1
fi
latest="$(latest_release_tag || true)"
current="$(current_source_version || true)"
[ -n "$latest" ] && [ -n "$current" ] || return 1
latest="${latest#v}"
if version_less_than "$latest" "$current"; then
echo "latest release $latest is older than source $current; skipping stale prebuilt" >&2
return 0
fi
return 1
}
find_extracted_binary() { find_extracted_binary() {
find "$1" -type f -name "$2" 2>/dev/null | sed -n '1p' find "$1" -type f -name "$2" 2>/dev/null | sed -n '1p'
} }
@@ -263,8 +401,8 @@ verify_archive_checksum() {
archive="$2" archive="$2"
checksum_file="$3" checksum_file="$3"
if ! curl -fsL "$url.sha256" -o "$checksum_file"; then if ! curl -fsL "$url.sha256" -o "$checksum_file"; then
echo "prebuilt checksum unavailable; continuing without sidecar verification" >&2 echo "prebuilt checksum unavailable; refusing unverified binary for $url" >&2
return 0 return 1
fi fi
expected="$(awk '{print $1}' "$checksum_file" | sed -n '1p')" expected="$(awk '{print $1}' "$checksum_file" | sed -n '1p')"
actual="$(sha256_file "$archive")" || { actual="$(sha256_file "$archive")" || {
@@ -312,6 +450,9 @@ verify_archive_version() {
} }
try_install_prebuilt() { try_install_prebuilt() {
if latest_release_is_stale; then
return 1
fi
download_url="$(release_latest_tag_download_url || release_download_url)" || return 1 download_url="$(release_latest_tag_download_url || release_download_url)" || return 1
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
archive="$tmpdir/$(release_artifact_name)" archive="$tmpdir/$(release_artifact_name)"
@@ -356,12 +497,7 @@ install_from_source() {
echo "DOSH_REPO or --repo is required when running the installer from curl" >&2 echo "DOSH_REPO or --repo is required when running the installer from curl" >&2
exit 2 exit 2
fi fi
case "$update_cache" in update_cache="$(safe_update_cache_path "$update_cache")"
""|"/"|"$HOME"|"$HOME/"|"$HOME/.cache")
echo "refusing unsafe update cache path: $update_cache" >&2
exit 2
;;
esac
need git need git
mkdir -p "$(dirname "$update_cache")" mkdir -p "$(dirname "$update_cache")"
if [ -d "$update_cache/.git" ]; then if [ -d "$update_cache/.git" ]; then
+52 -1
View File
@@ -11,6 +11,8 @@ Environment:
GITEA_REPO owner/repo, default Palav/dosh GITEA_REPO owner/repo, default Palav/dosh
GITEA_TOKEN Token with release write permission GITEA_TOKEN Token with release write permission
GITEA_TITLE Release title, default TAG GITEA_TITLE Release title, default TAG
DOSH_RELEASE_ALLOW_PARTIAL=1
Allow uploading an incomplete platform set. Default: refuse.
EOF EOF
} }
@@ -31,6 +33,11 @@ repo="${GITEA_REPO:-Palav/dosh}"
token="${GITEA_TOKEN:-}" token="${GITEA_TOKEN:-}"
title="${GITEA_TITLE:-$tag}" title="${GITEA_TITLE:-$tag}"
expected_version="${tag#v}" expected_version="${tag#v}"
allow_partial="${DOSH_RELEASE_ALLOW_PARTIAL:-0}"
release_prerelease=false
case "$expected_version" in
*-*) release_prerelease=true ;;
esac
artifact_version() { artifact_version() {
artifact="$1" artifact="$1"
@@ -80,6 +87,42 @@ if [ "$#" -eq 0 ]; then
done done
fi fi
require_complete_release_artifacts() {
[ "$allow_partial" = "1" ] && return 0
missing=0
for required in \
dosh-linux-x86_64.tar.gz \
dosh-macos-aarch64.tar.gz \
dosh-macos-x86_64.tar.gz \
dosh-windows-x86_64.zip; do
found=0
checksum_found=0
for artifact in "$@"; do
name="$(basename "$artifact")"
if [ "$name" = "$required" ]; then
found=1
fi
if [ "$name" = "$required.sha256" ]; then
checksum_found=1
fi
done
if [ "$found" -ne 1 ]; then
echo "missing required release artifact: $required" >&2
missing=1
fi
if [ "$checksum_found" -ne 1 ]; then
echo "missing required release checksum: $required.sha256" >&2
missing=1
fi
done
if [ "$missing" -ne 0 ]; then
echo "refusing partial release upload; set DOSH_RELEASE_ALLOW_PARTIAL=1 to override" >&2
exit 1
fi
}
require_complete_release_artifacts "$@"
api="$base/api/v1/repos/$repo" api="$base/api/v1/repos/$repo"
auth_header="Authorization: token $token" auth_header="Authorization: token $token"
@@ -92,7 +135,7 @@ elif [ -n "$release_json" ]; then
fi fi
if [ -z "$release_id" ]; then if [ -z "$release_id" ]; then
payload="$(printf '{"tag_name":"%s","target_commitish":"main","name":"%s","body":"Dosh release %s","draft":false,"prerelease":false}\n' "$tag" "$title" "$tag")" payload="$(printf '{"tag_name":"%s","target_commitish":"main","name":"%s","body":"Dosh release %s","draft":false,"prerelease":%s}\n' "$tag" "$title" "$tag" "$release_prerelease")"
release_json="$(curl -fsS -H "$auth_header" -H 'Content-Type: application/json' -X POST "$api/releases" -d "$payload")" release_json="$(curl -fsS -H "$auth_header" -H 'Content-Type: application/json' -X POST "$api/releases" -d "$payload")"
if command -v jq >/dev/null 2>&1; then if command -v jq >/dev/null 2>&1; then
release_id="$(printf '%s\n' "$release_json" | jq -r '.id // empty')" release_id="$(printf '%s\n' "$release_json" | jq -r '.id // empty')"
@@ -106,6 +149,14 @@ if [ -z "$release_id" ]; then
exit 1 exit 1
fi fi
metadata_payload="$(printf '{"name":"%s","body":"Dosh release %s","draft":false,"prerelease":%s}\n' "$title" "$tag" "$release_prerelease")"
curl -fsS \
-H "$auth_header" \
-H 'Content-Type: application/json' \
-X PATCH \
"$api/releases/$release_id" \
-d "$metadata_payload" >/dev/null
delete_existing_asset() { delete_existing_asset() {
name="$1" name="$1"
if ! command -v jq >/dev/null 2>&1; then if ! command -v jq >/dev/null 2>&1; then
+73
View File
@@ -22,6 +22,70 @@ artifact_version() {
esac esac
} }
archive_contains() {
artifact="$1"
member="$2"
case "$artifact" in
*.tar.gz)
tar -tzf "$artifact" "$member" >/dev/null 2>&1
;;
*.zip)
unzip -Z1 "$artifact" 2>/dev/null | grep -Fx "$member" >/dev/null 2>&1
;;
*)
return 1
;;
esac
}
expected_members() {
artifact_name="$(basename -- "$1")"
case "$artifact_name" in
dosh-windows-*.zip)
cat <<EOF
dosh/VERSION
dosh/bin/dosh.exe
dosh/bin/dosh-client.exe
dosh/bin/dosh-bench.exe
EOF
;;
dosh-*.tar.gz)
cat <<EOF
dosh/VERSION
dosh/bin/dosh
dosh/bin/dosh-client
dosh/bin/dosh-server
dosh/bin/dosh-auth
dosh/bin/dosh-bench
EOF
;;
*)
cat <<EOF
dosh/VERSION
EOF
;;
esac
}
checksum_value() {
artifact="$1"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$artifact" | awk '{print $1}'
elif command -v shasum >/dev/null 2>&1; then
shasum -a 256 "$artifact" | awk '{print $1}'
else
return 1
fi
}
verify_checksum() {
artifact="$1"
checksum="$artifact.sha256"
expected="$(awk '{print $1; exit}' "$checksum")"
actual="$(checksum_value "$artifact" || true)"
[ -n "$actual" ] && [ "$actual" = "$expected" ]
}
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
artifacts="$*" artifacts="$*"
else else
@@ -38,12 +102,21 @@ for artifact in $artifacts; do
if [ ! -f "$artifact.sha256" ]; then if [ ! -f "$artifact.sha256" ]; then
echo "missing release checksum: $artifact.sha256" >&2 echo "missing release checksum: $artifact.sha256" >&2
failed=1 failed=1
elif ! verify_checksum "$artifact"; then
echo "release checksum mismatch: $artifact" >&2
failed=1
fi fi
actual="$(artifact_version "$artifact" || true)" actual="$(artifact_version "$artifact" || true)"
if [ "$actual" != "$version" ]; then if [ "$actual" != "$version" ]; then
echo "artifact version mismatch: $artifact has ${actual:-unknown}, expected $version" >&2 echo "artifact version mismatch: $artifact has ${actual:-unknown}, expected $version" >&2
failed=1 failed=1
fi fi
for member in $(expected_members "$artifact"); do
if ! archive_contains "$artifact" "$member"; then
echo "artifact missing expected member: $artifact:$member" >&2
failed=1
fi
done
done done
exit "$failed" exit "$failed"
+1259 -103
View File
File diff suppressed because it is too large Load Diff
+1078 -74
View File
File diff suppressed because it is too large Load Diff
+62
View File
@@ -5,6 +5,7 @@ use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
pub struct ServerConfig { pub struct ServerConfig {
pub port: u16, pub port: u16,
pub bind: String, pub bind: String,
@@ -95,6 +96,7 @@ impl Default for ServerConfig {
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
pub struct ClientConfig { pub struct ClientConfig {
pub update_repo: Option<String>, pub update_repo: Option<String>,
pub update_port: Option<u16>, pub update_port: Option<u16>,
@@ -330,3 +332,63 @@ pub fn expand_tilde(path: &str) -> PathBuf {
} }
PathBuf::from(path) PathBuf::from(path)
} }
#[cfg(test)]
mod tests {
use super::{ClientConfig, ServerConfig};
#[test]
fn old_client_configs_fill_new_fields_from_defaults() {
let raw = r#"
server = "palav"
dosh_port = 50000
"#;
let config: ClientConfig = toml::from_str(raw).expect("parse old client config");
assert_eq!(config.server, "palav");
assert!(config.predict);
assert_eq!(config.predict_mode, "experimental");
assert_eq!(config.auth_preference, "native,ssh");
assert_eq!(config.native_auth_timeout_ms, 700);
assert_eq!(config.known_hosts, "~/.config/dosh/known_hosts");
assert_eq!(config.identity_files, vec!["~/.ssh/id_ed25519"]);
assert!(config.use_ssh_agent);
assert!(!config.forward_agent);
assert!(config.disconnect_status);
assert_eq!(config.escape_key, "^]");
assert!(config.send_env.iter().any(|value| value == "TERM"));
}
#[test]
fn old_server_configs_fill_new_fields_from_defaults() {
let raw = r#"
port = 50000
"#;
let config: ServerConfig = toml::from_str(raw).expect("parse old server config");
assert_eq!(config.port, 50000);
assert_eq!(config.bind, "0.0.0.0");
assert_eq!(config.client_timeout_secs, 2_592_000);
assert_eq!(config.output_frame_interval_ms, 16);
assert!(config.native_auth);
assert_eq!(config.host_key, "~/.config/dosh/host_key");
assert!(
config
.authorized_keys
.iter()
.any(|path| path == "~/.ssh/authorized_keys")
);
assert_eq!(config.native_auth_rate_limit_per_minute, 30);
assert_eq!(config.rekey_after_packets, 100_000);
assert_eq!(config.rekey_after_secs, 3600);
assert!(config.allow_tcp_forwarding);
assert!(!config.allow_remote_forwarding);
assert!(!config.allow_agent_forwarding);
assert!(config.allow_file_transfer);
assert!(config.allow_exec_command);
assert!(config.persist_sessions);
assert!(config.accept_env.iter().any(|value| value == "TERM"));
}
}
+21
View File
@@ -32,6 +32,7 @@ impl FrameDecoder {
} }
let len = u32::from_be_bytes(self.buf[..4].try_into().unwrap()) as usize; let len = u32::from_be_bytes(self.buf[..4].try_into().unwrap()) as usize;
if len > FRAME_MAX_LEN { if len > FRAME_MAX_LEN {
self.buf.clear();
bail!("exec protocol frame too large: {len} bytes"); bail!("exec protocol frame too large: {len} bytes");
} }
if self.buf.len() < 4 + len { if self.buf.len() < 4 + len {
@@ -69,3 +70,23 @@ fn encode_frame(payload: &[u8]) -> Result<Vec<u8>> {
out.extend_from_slice(payload); out.extend_from_slice(payload);
Ok(out) Ok(out)
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn oversized_frame_clears_decoder_state() {
let mut decoder = FrameDecoder::default();
let too_large = ((FRAME_MAX_LEN + 1) as u32).to_be_bytes();
assert!(decoder.push(&too_large).is_err());
let valid = encode_response(&ExecResponse::Exit { code: Some(0) }).unwrap();
let frames = decoder.push(&valid).unwrap();
assert_eq!(frames.len(), 1);
assert_eq!(
decode_response(&frames[0]).unwrap(),
ExecResponse::Exit { code: Some(0) }
);
}
}
+64
View File
@@ -123,6 +123,7 @@ impl FrameDecoder {
} }
let len = u32::from_be_bytes(self.buf[..4].try_into().unwrap()) as usize; let len = u32::from_be_bytes(self.buf[..4].try_into().unwrap()) as usize;
if len > FRAME_MAX_LEN { if len > FRAME_MAX_LEN {
self.buf.clear();
bail!("file protocol frame too large: {len} bytes"); bail!("file protocol frame too large: {len} bytes");
} }
if self.buf.len() < 4 + len { if self.buf.len() < 4 + len {
@@ -165,6 +166,12 @@ pub fn parse_copy_endpoint(raw: &str) -> CopyEndpoint {
if looks_like_windows_path(raw) { if looks_like_windows_path(raw) {
return CopyEndpoint::Local(PathBuf::from(raw)); return CopyEndpoint::Local(PathBuf::from(raw));
} }
if let Some((host, path)) = parse_bracketed_remote_endpoint(raw) {
return CopyEndpoint::Remote { host, path };
}
if raw.starts_with('[') {
return CopyEndpoint::Local(PathBuf::from(raw));
}
let Some(index) = raw.find(':') else { let Some(index) = raw.find(':') else {
return CopyEndpoint::Local(PathBuf::from(raw)); return CopyEndpoint::Local(PathBuf::from(raw));
}; };
@@ -183,6 +190,25 @@ pub fn parse_copy_endpoint(raw: &str) -> CopyEndpoint {
} }
} }
fn parse_bracketed_remote_endpoint(raw: &str) -> Option<(String, String)> {
let rest = raw.strip_prefix('[')?;
let close = rest.find(']')?;
let host = &rest[..close];
let suffix = &rest[close + 1..];
if host.is_empty() || host.contains('/') || host.contains('\\') || !suffix.starts_with(':') {
return None;
}
let path = &suffix[1..];
Some((
host.to_string(),
if path.is_empty() {
".".to_string()
} else {
path.to_string()
},
))
}
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum CopyEndpoint { pub enum CopyEndpoint {
Local(PathBuf), Local(PathBuf),
@@ -263,6 +289,18 @@ mod tests {
assert_eq!(frames.len(), 1); assert_eq!(frames.len(), 1);
} }
#[test]
fn oversized_frame_clears_decoder_state() {
let mut decoder = FrameDecoder::default();
let too_large = ((FRAME_MAX_LEN + 1) as u32).to_be_bytes();
assert!(decoder.push(&too_large).is_err());
let valid = encode_response(&FileResponse::Ok).unwrap();
let frames = decoder.push(&valid).unwrap();
assert_eq!(frames.len(), 1);
assert_eq!(decode_response(&frames[0]).unwrap(), FileResponse::Ok);
}
#[test] #[test]
fn copy_endpoint_parses_scp_style_but_not_windows_drive() { fn copy_endpoint_parses_scp_style_but_not_windows_drive() {
assert_eq!( assert_eq!(
@@ -277,4 +315,30 @@ mod tests {
CopyEndpoint::Local(PathBuf::from("C:\\Users\\palav\\x")) CopyEndpoint::Local(PathBuf::from("C:\\Users\\palav\\x"))
); );
} }
#[test]
fn copy_endpoint_parses_bracketed_ipv6_remote_paths() {
assert_eq!(
parse_copy_endpoint("[2001:db8::1]:/var/log/syslog"),
CopyEndpoint::Remote {
host: "2001:db8::1".to_string(),
path: "/var/log/syslog".to_string()
}
);
assert_eq!(
parse_copy_endpoint("[::1]:"),
CopyEndpoint::Remote {
host: "::1".to_string(),
path: ".".to_string()
}
);
assert_eq!(
parse_copy_endpoint("[bad/host]:path"),
CopyEndpoint::Local(PathBuf::from("[bad/host]:path"))
);
assert_eq!(
parse_copy_endpoint("[::1]"),
CopyEndpoint::Local(PathBuf::from("[::1]"))
);
}
} }
+3 -1
View File
@@ -5,7 +5,9 @@
//! handle native authentication, host key checks, roaming, keepalives, reliable //! handle native authentication, host key checks, roaming, keepalives, reliable
//! streams, and service routing. Use [`transport::DoshTransport`] only when an //! streams, and service routing. Use [`transport::DoshTransport`] only when an
//! application already owns session establishment and wants direct access to the //! application already owns session establishment and wants direct access to the
//! encrypted stream transport. //! encrypted stream transport. The SDK receive loops drive retransmission and
//! keepalives while waiting, so simple applications can call `recv().await`
//! without building their own maintenance loop.
pub mod auth; pub mod auth;
pub mod build_info; pub mod build_info;
+11 -7
View File
@@ -5,10 +5,11 @@ use anyhow::{Context, Result, bail};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
/// Generate a name for an implicit, ephemeral terminal session the kind /// Generate a name for an implicit terminal session: the kind created by
/// created by `dosh host` with no `--session`. Single source of truth shared by /// `dosh host` with no `--session`. Single source of truth shared by the client
/// the client (which generates it) and the server (which recognizes it via /// (which generates it) and the server (which recognizes it via
/// [`is_implicit_session_name`] to decide a session is NOT worth persisting). /// [`is_implicit_session_name`] to apply shorter cleanup grace than named
/// sessions).
pub fn generate_implicit_session_name() -> String { pub fn generate_implicit_session_name() -> String {
let millis = SystemTime::now() let millis = SystemTime::now()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
@@ -18,9 +19,9 @@ pub fn generate_implicit_session_name() -> String {
} }
/// Whether `name` is a client-generated implicit session name /// Whether `name` is a client-generated implicit session name
/// (`term-<digits>-<digits>`). Such sessions are ephemeral: the user can never /// (`term-<digits>-<digits>`). Such sessions are update-survivable while the
/// reattach by name, so the server must not persist them across restarts. /// original client can reconnect with its ticket, but they are reaped sooner
/// Explicitly-named (`--session work`) and prewarmed sessions are not implicit. /// than explicitly-named sessions once no clients remain.
pub fn is_implicit_session_name(name: &str) -> bool { pub fn is_implicit_session_name(name: &str) -> bool {
let Some(rest) = name.strip_prefix("term-") else { let Some(rest) = name.strip_prefix("term-") else {
return false; return false;
@@ -272,6 +273,9 @@ pub fn decode(input: &[u8]) -> Result<Packet> {
if input.len() < end { if input.len() < end {
bail!("truncated packet body"); bail!("truncated packet body");
} }
if input.len() > end {
bail!("trailing packet bytes");
}
Ok(Packet { Ok(Packet {
header, header,
body: input[HEADER_LEN..end].to_vec(), body: input[HEADER_LEN..end].to_vec(),
+113 -15
View File
@@ -10,8 +10,8 @@ use crate::protocol::{
NativeServerHelloBody, NativeUserAuthBody, PacketKind, SERVER_TO_CLIENT, NativeServerHelloBody, NativeUserAuthBody, PacketKind, SERVER_TO_CLIENT,
}; };
use crate::transport::{ use crate::transport::{
DoshTransport, SessionEvent, SessionRole, SessionTransportConfig, TransportConfig, ADAPTIVE_RETRANSMIT_MIN, DoshTransport, SessionEvent, SessionRole, SessionTransportConfig,
service_name_from_target, TransportConfig, service_name_from_target,
}; };
use crate::udp::{is_transient_udp_error, is_transient_udp_send_error}; use crate::udp::{is_transient_udp_error, is_transient_udp_send_error};
use anyhow::{Context, Result, anyhow, bail}; use anyhow::{Context, Result, anyhow, bail};
@@ -169,33 +169,52 @@ impl DoshServer {
let mut buf = vec![0u8; 65535]; let mut buf = vec![0u8; 65535];
loop { loop {
self.expire_pending(); self.expire_pending();
let (n, peer) = match self.socket.recv_from(&mut buf).await { let (n, peer) = match tokio::time::timeout(
Ok(value) => value, ADAPTIVE_RETRANSMIT_MIN,
Err(err) if is_transient_udp_error(&err) => continue, self.socket.recv_from(&mut buf),
Err(err) => return Err(err.into()), )
.await
{
Ok(Ok(value)) => value,
Ok(Err(err)) if is_transient_udp_error(&err) => continue,
Ok(Err(err)) => return Err(err.into()),
Err(_) => {
self.maintenance().await?;
continue;
}
}; };
let packet = match protocol::decode(&buf[..n]) { if let Some(event) = self.handle_datagram(peer, &buf[..n]).await? {
return Ok(event);
}
}
}
async fn handle_datagram(
&mut self,
peer: SocketAddr,
datagram: &[u8],
) -> Result<Option<DoshServerEvent>> {
let packet = match protocol::decode(datagram) {
Ok(packet) => packet, Ok(packet) => packet,
Err(_) => continue, Err(_) => return Ok(None),
}; };
if packet.header.kind == PacketKind::NativeClientHello { if packet.header.kind == PacketKind::NativeClientHello {
self.handle_client_hello(peer, packet.body).await?; self.handle_client_hello(peer, packet.body).await?;
return Ok(DoshServerEvent::Ignored); return Ok(Some(DoshServerEvent::Ignored));
} }
if packet.header.kind == PacketKind::NativeUserAuth { if packet.header.kind == PacketKind::NativeUserAuth {
return self.handle_user_auth(peer, &packet).await; return self.handle_user_auth(peer, &packet).await.map(Some);
} }
if let Some(transport) = self.transports.get_mut(&packet.header.conn_id) { if let Some(transport) = self.transports.get_mut(&packet.header.conn_id) {
let event = transport.handle_datagram(&buf[..n], peer).await?; let event = transport.handle_datagram(datagram, peer).await?;
return Ok(DoshServerEvent::Session { return Ok(Some(DoshServerEvent::Session {
conn_id: packet.header.conn_id, conn_id: packet.header.conn_id,
event, event,
}); }));
} }
self.send_reject(peer, packet.header.conn_id, "unknown Dosh connection") self.send_reject(peer, packet.header.conn_id, "unknown Dosh connection")
.await?; .await?;
return Ok(DoshServerEvent::Ignored); Ok(Some(DoshServerEvent::Ignored))
}
} }
pub async fn accept_stream(&mut self, conn_id: [u8; 16], stream_id: u64) -> Result<()> { pub async fn accept_stream(&mut self, conn_id: [u8; 16], stream_id: u64) -> Result<()> {
@@ -620,6 +639,85 @@ mod tests {
} }
} }
#[tokio::test]
async fn sdk_server_recv_drives_transport_maintenance_while_idle() {
let dir = tempfile::tempdir().unwrap();
let host_key = dir.path().join("host_key");
let authorized_keys = dir.path().join("authorized_keys");
let signing = SigningKey::from_bytes(&[94u8; 32]);
let keypair = ssh_key::private::Ed25519Keypair::from(&signing);
let private =
ssh_key::PrivateKey::new(ssh_key::private::KeypairData::from(keypair), "").unwrap();
std::fs::write(
&authorized_keys,
format!("{}\n", private.public_key().to_openssh().unwrap()),
)
.unwrap();
let server_config = ServerConfig {
host_key: host_key.to_string_lossy().to_string(),
authorized_keys: vec![authorized_keys.to_string_lossy().to_string()],
..ServerConfig::default()
};
let server_config = DoshServerConfig::new(server_config)
.bind_addr("127.0.0.1:0".parse().unwrap())
.service("echo")
.unwrap()
.require_current_user(false)
.transport(TransportConfig {
retransmit_after: Duration::from_millis(20),
keepalive_after: Duration::from_secs(60),
..TransportConfig::default()
});
let mut server = DoshServer::bind(server_config).await.unwrap();
let client_socket = UdpSocket::bind("127.0.0.1:0").await.unwrap();
let client_addr = client_socket.local_addr().unwrap();
let conn_id = [95u8; 16];
let session_key = [96u8; 32];
let transport = DoshTransport::new(
Arc::clone(&server.socket),
SessionTransportConfig {
role: SessionRole::Server,
conn_id,
session_key,
peer_addr: client_addr,
initial_send_seq: 1,
initial_ack: 0,
stream: server.config.transport.clone(),
},
);
server.transports.insert(conn_id, transport);
server
.transport_mut(&conn_id)
.unwrap()
.open_service("echo")
.await
.unwrap();
let mut buf = [0u8; 65535];
tokio::time::timeout(
Duration::from_millis(200),
client_socket.recv_from(&mut buf),
)
.await
.unwrap()
.unwrap();
let recv_task = tokio::spawn(async move { server.recv().await });
let (n, _) =
tokio::time::timeout(Duration::from_secs(1), client_socket.recv_from(&mut buf))
.await
.unwrap()
.unwrap();
recv_task.abort();
let packet = protocol::decode(&buf[..n]).unwrap();
assert_eq!(packet.header.kind, PacketKind::StreamOpen);
let plain = protocol::decrypt_body(&packet, &session_key, SERVER_TO_CLIENT).unwrap();
let open: protocol::StreamOpen = protocol::from_body(&plain).unwrap();
assert_eq!(open.target_host, "@dosh-echo");
}
#[tokio::test] #[tokio::test]
async fn bad_native_auth_does_not_consume_pending_challenge() { async fn bad_native_auth_does_not_consume_pending_challenge() {
let dir = tempfile::tempdir().unwrap(); let dir = tempfile::tempdir().unwrap();
+950 -94
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -58,6 +58,21 @@ fn encrypted_packet_round_trips() {
assert_eq!(plain, b"hello"); assert_eq!(plain, b"hello");
} }
#[test]
fn packet_decode_rejects_truncated_or_trailing_datagrams() {
let packet =
protocol::encode_plain(PacketKind::Ping, crypto::random_16(), 1, 0, b"hello").unwrap();
let truncated = &packet[..packet.len() - 1];
let err = protocol::decode(truncated).unwrap_err();
assert!(err.to_string().contains("truncated packet body"));
let mut trailing = packet.clone();
trailing.extend_from_slice(b"junk");
let err = protocol::decode(&trailing).unwrap_err();
assert!(err.to_string().contains("trailing packet bytes"));
}
#[test] #[test]
fn plaintext_packet_never_decrypts_as_authenticated_body() { fn plaintext_packet_never_decrypts_as_authenticated_body() {
let key = crypto::random_32(); let key = crypto::random_32();
+216
View File
@@ -19,6 +19,199 @@ fn release_scripts_skip_stale_artifacts_when_auto_discovering() {
assert!(publish.contains("actual=\"$(artifact_version \"$artifact\" || true)\"")); assert!(publish.contains("actual=\"$(artifact_version \"$artifact\" || true)\""));
} }
#[test]
fn release_upload_refuses_partial_platform_sets_by_default() {
let upload = include_str!("../scripts/upload-gitea-release.sh");
assert!(upload.contains("require_complete_release_artifacts \"$@\""));
assert!(upload.contains("DOSH_RELEASE_ALLOW_PARTIAL=1"));
assert!(upload.contains("refusing partial release upload"));
for name in [
"dosh-linux-x86_64.tar.gz",
"dosh-macos-aarch64.tar.gz",
"dosh-macos-x86_64.tar.gz",
"dosh-windows-x86_64.zip",
] {
assert!(
upload.contains(name),
"release upload completeness check must require {name}"
);
}
}
#[test]
fn release_upload_marks_prerelease_tags_as_prereleases() {
let upload = include_str!("../scripts/upload-gitea-release.sh");
assert!(upload.contains("release_prerelease=false"));
assert!(upload.contains("*-*) release_prerelease=true"));
assert!(upload.contains("\"prerelease\":%s"));
assert!(upload.contains("metadata_payload="));
assert!(
upload.contains("-X PATCH"),
"existing Gitea releases must be corrected when prerelease metadata changes"
);
}
#[test]
fn release_gates_test_all_targets() {
let makefile = include_str!("../Makefile");
let ci = include_str!("../.github/workflows/ci.yml");
assert!(makefile.contains("test:\n\tcargo test --all-targets"));
assert!(makefile.contains("cargo test --all-targets\n\t$(MAKE) tui-harness"));
assert!(ci.contains("run: sh -n install.sh scripts/*.sh"));
assert!(ci.contains("run: cargo clippy --all-targets -- -D warnings"));
assert!(ci.contains("run: cargo test --all-targets"));
assert!(ci.contains("run: sh scripts/tui-harness.sh"));
}
#[test]
fn one_dot_zero_gates_default_to_full_length_soaks() {
let makefile = include_str!("../Makefile");
let reconnect_check = makefile
.split("reconnect-check:")
.nth(1)
.and_then(|tail| tail.split("\nhostile-network-check:").next())
.expect("reconnect-check target");
assert!(reconnect_check.contains("DOSH_SOAK_SECONDS=$${DOSH_SOAK_SECONDS:-1800}"));
assert!(!reconnect_check.contains("DOSH_SOAK_SECONDS=$${DOSH_SOAK_SECONDS:-300}"));
let hostile_check = makefile
.split("hostile-network-check:")
.nth(1)
.and_then(|tail| tail.split("\npersistence-check:").next())
.expect("hostile-network-check target");
assert!(hostile_check.contains("DOSH_BADNET_SOAK_SECONDS=$${DOSH_BADNET_SOAK_SECONDS:-1800}"));
assert!(!hostile_check.contains("DOSH_BADNET_SOAK_SECONDS=$${DOSH_BADNET_SOAK_SECONDS:-300}"));
}
#[test]
fn installers_skip_stale_latest_release_prebuilts() {
let install = include_str!("../install.sh");
assert!(install.contains("latest_release_is_stale"));
assert!(install.contains("current_source_version"));
assert!(install.contains("latest release $latest is older than source $current"));
assert!(install.contains("version_prerelease"));
assert!(install.contains("prerelease_less_than"));
assert!(
install.contains("if latest_release_is_stale; then"),
"unix installer must skip stale latest before downloading a prebuilt"
);
let ps1 = include_str!("../install.ps1");
assert!(ps1.contains("Latest-ReleaseIsStale"));
assert!(ps1.contains("Current-SourceVersion"));
assert!(ps1.contains("latest release $latestVersion is older than source $current"));
assert!(ps1.contains("Version-Prerelease"));
assert!(ps1.contains("Compare-Prerelease"));
assert!(
ps1.contains("if (Latest-ReleaseIsStale)"),
"windows installer must skip stale latest before downloading a prebuilt"
);
}
#[test]
fn installers_refuse_prebuilts_without_checksums() {
let install = include_str!("../install.sh");
assert!(install.contains("verify_archive_checksum"));
assert!(install.contains("refusing unverified binary for $url"));
assert!(
!install.contains("continuing without sidecar verification"),
"unix installer must not silently install an unverifiable prebuilt"
);
let ps1 = include_str!("../install.ps1");
assert!(ps1.contains("Verify-ArchiveChecksum"));
assert!(ps1.contains("refusing unverified binary for $Url"));
assert!(
!ps1.contains("continuing without sidecar verification"),
"windows installer must not silently install an unverifiable prebuilt"
);
}
#[test]
fn windows_installer_reuses_persistent_source_update_cache() {
let ps1 = include_str!("../install.ps1");
assert!(ps1.contains("DOSH_UPDATE_CACHE"));
assert!(ps1.contains("Assert-NoRelativePathSegments($Path)"));
assert!(ps1.contains("Assert-NoRelativePathSegments $Path"));
assert!(ps1.contains("$segment -eq \".\" -or $segment -eq \"..\""));
assert!(ps1.contains("$sourceCache = Assert-SafeUpdateCache $UpdateCache"));
assert!(ps1.contains("git -C $sourceCache fetch --depth 1 origin main"));
assert!(ps1.contains("git -C $sourceCache checkout -q -B main FETCH_HEAD"));
assert!(ps1.contains("git clone --depth 1 --branch main $Repo $sourceCache"));
assert!(
!ps1.contains("git clone --depth 1 $Repo $tmp"),
"Windows source updates should reuse a persistent cache instead of recloning into temp"
);
}
#[test]
fn unix_installer_rejects_unsafe_source_update_cache_paths() {
let install = include_str!("../install.sh");
assert!(install.contains("normalize_update_cache_path()"));
assert!(install.contains("safe_update_cache_path()"));
assert!(install.contains("update_cache=\"$(safe_update_cache_path \"$update_cache\")\""));
for pattern in [
"\"\"|\"/\"|\"$home_norm\"|\"$home_cache_norm\"",
"\".\"|\"..\"|./*|../*|*/.|*/..|*/./*|*/../*",
] {
assert!(
install.contains(pattern),
"Unix installer must reject unsafe update cache pattern {pattern}"
);
}
assert!(
install.contains("rm -rf \"$update_cache\""),
"source cache replacement remains the destructive operation guarded by safe_update_cache_path"
);
}
#[test]
fn installers_generate_same_native_auth_client_defaults() {
let install = include_str!("../install.sh");
let ps1 = include_str!("../install.ps1");
for setting in [
"auth_preference = \"native,ssh\"",
"trust_on_first_use = false",
"native_auth_timeout_ms = 700",
"known_hosts = \"~/.config/dosh/known_hosts\"",
"identity_files = [\"~/.ssh/id_ed25519\"]",
"use_ssh_agent = true",
"forward_agent = false",
] {
assert!(
install.contains(setting),
"Unix installer missing client default {setting}"
);
assert!(
ps1.contains(setting),
"Windows installer missing client default {setting}"
);
}
}
#[test]
fn windows_installer_generates_hosts_config_like_unix() {
let install = include_str!("../install.sh");
let ps1 = include_str!("../install.ps1");
for setting in [
"hosts.toml",
"# default_command = \"tm\"",
"[default]",
"predict = true",
] {
assert!(
install.contains(setting),
"Unix installer missing host config setting {setting}"
);
assert!(
ps1.contains(setting),
"Windows installer missing host config setting {setting}"
);
}
assert!(ps1.contains("$hostUdp = if ($DoshHost) { $DoshHost } else { $defaultServer }"));
assert!(ps1.contains("Set-Content -NoNewline -Encoding utf8 $hostsConfig"));
}
#[test] #[test]
fn package_check_verifies_only_artifacts_it_builds() { fn package_check_verifies_only_artifacts_it_builds() {
let makefile = include_str!("../Makefile"); let makefile = include_str!("../Makefile");
@@ -51,6 +244,29 @@ fn complete_release_verifier_requires_both_macos_architectures() {
assert!(verify.contains("dosh-windows-x86_64.zip")); assert!(verify.contains("dosh-windows-x86_64.zip"));
} }
#[test]
fn release_verifier_checks_checksums_and_expected_binaries() {
let verify = include_str!("../scripts/verify-release-artifacts.sh");
assert!(verify.contains("verify_checksum()"));
assert!(verify.contains("release checksum mismatch"));
for member in [
"dosh/bin/dosh",
"dosh/bin/dosh-client",
"dosh/bin/dosh-server",
"dosh/bin/dosh-auth",
"dosh/bin/dosh-bench",
"dosh/bin/dosh.exe",
"dosh/bin/dosh-client.exe",
"dosh/bin/dosh-bench.exe",
] {
assert!(
verify.contains(member),
"release verifier must require archive member {member}"
);
}
assert!(verify.contains("artifact missing expected member"));
}
#[test] #[test]
fn package_release_stamps_git_build_info() { fn package_release_stamps_git_build_info() {
let package = include_str!("../scripts/package-release.sh"); let package = include_str!("../scripts/package-release.sh");