Skip to content

fix: require verified installer downloads before replacement - #759

Draft
justrach wants to merge 4 commits into
release/0.2.5856from
fix/verified-installer-release
Draft

justrach wants to merge 4 commits into
release/0.2.5856from
fix/verified-installer-release

Conversation

@justrach

@justrach justrach commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

What changed

The macOS/Linux installer now requires exactly one valid SHA-256 entry for the selected release asset and a working hash tool before it replaces an existing binary. It downloads to a destination-local temporary file, verifies there, and removes the temporary file on failure. The checked-in website installer copies remain byte-identical. A CODEDB_NO_INTEGRATIONS guard keeps integration registration out of isolated installs while preserving the release branch's detected-client registration for normal installs. The installed hook no longer blocks native sed/awk edits with advice to use the removed codedb_edit tool.

Why

On the current release/0.2.5856 branch, an unavailable checksum manifest or missing hash tool produces a warning but still installs unverified bytes over the prior binary. That is a fail-open supply-chain path. Requiring a unique valid manifest entry and verifying before the move preserves the existing installation on download, manifest, hash, or verification failure. The trade-off is intentional: installation now stops during a manifest outage rather than falling back to an unverified binary. Keeping the temporary file in the destination directory also avoids a cross-filesystem replacement. The old sed/awk hook advice cannot work because CodeDB no longer offers an edit tool.

This is isolated from draft PR #750's retrieval/transport changes and draft PR #758's watcher changes. It does not alter hosted Jina, default hybrid retrieval, or the 4× ANN candidate pool.

Verification — exact head 2ba90d4518906c4c26c5b819a3f4e43a96b84c02

The latest commit rejects selected-asset checksum lines with trailing fields. It changes installer scripts and the test fixture only; Zig sources and the compiled binary are unchanged.

  • Local: python3.12 scripts/test_installer_safety.py — 17/17 cases passed at this head: nine isolated failure/opt-out installs (including mismatch and trailing-field manifests with integrations enabled and existing config unchanged), one successful normal main install, three Claude/Codex/detected-Qwen registrations preserving other servers, and four commands run through the hook actually installed by main. All fixtures use disposable HOME directories. bash -n install/install.sh website/app/install_script.sh website/dist/install.sh passed; the three scripts are byte-identical. zig build -Doptimize=ReleaseFast passed before this shell-only parser edit (arm64 candidate SHA-256 d240207f1df64df192b0bb556b4e56b18c79c3be6a36a1211ecee9549788fe60); no Zig source changed.
  • Local: python3 scripts/e2e_mcp_test.py --binary .graff/verify/codedb-installer-branch --project "$PWD" — 76/76 passed.
  • Local: zig build test --summary all — fails in the unchanged semantic retry test (EmbeddingTimeout): 1,620 passed, 13 skipped, one failed. This reproduces on a clean release/0.2.5856 worktree at 565238036b7a2e29dc13972a45f5d59910d3fbfd with zig build test-semantic --summary all (27/28 passed, same timeout); a separately filtered run also failed 0/1 on that timeout. No Zig files change in this PR. Do not treat this as a green unit suite.
  • Remote: exact-head CI for 2ba90d4 passed bench (5m14s) and macos-resource-regression (2m59s); the guard job was skipped. The prior head 07a44bd also passed both jobs. The clean-base semantic-suite failure above remains disclosed rather than counted as a pass.

Merging this PR only updates the release branch; it does not create a new tag, signed/notarized artifact, or deployment. The published v0.2.5856 tag remains unchanged. Release publication also remains gated by the separate hosted-Jina rejection.

The release-branch shell installer currently warns and replaces an existing binary when its checksum manifest is unavailable or no hash tool is installed. Require one valid SHA-256 entry, verify downloaded bytes in a destination-local temporary file, and leave the prior binary untouched on every failure path.

Keep the three published script copies synchronized, preserve detected-client registration behind the new integration opt-out, and stop the installed hook from pointing at the removed codedb_edit tool for native sed/awk commands. Exercise checksum failures, valid install, hooks, and registration with isolated fixtures.

Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
The failure-path fixture opted out of integrations and exercised an extracted hook, so it did not prove the normal installation dispatch. Run a verified install inside a disposable HOME, assert detected-client registration preserves other servers, and invoke the hook file installed by main. Keep every failure scenario isolated from real client configuration.

Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
justrach and others added 2 commits September 26, 2026 15:27
The existing failure fixtures opt out of integrations, which cannot prove that an invalid checksum stops before client configuration is touched. Run the mismatched-hash case with integrations enabled in a disposable HOME and assert its preexisting Claude registration remains byte-for-byte unchanged.

Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
The verifier matched the selected asset in the second field but ignored trailing fields, so a malformed manifest line with a correct hash could authorize replacement. Require exactly two fields on each selected-asset entry and count malformed duplicates as conflicts.

Exercise the trailing-field case through the installer's main path with integrations enabled; failure must leave the prior binary and client configuration unchanged.

Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
@justrach

Copy link
Copy Markdown
Owner Author

Status: exact-head 2ba90d4 passed bench and macos-resource-regression; the installer suite passed 17/17 and MCP E2E passed 76/76. The unchanged semantic retry unit test fails on a clean release-base worktree and is disclosed in the PR body. An attempt to mark this PR ready was blocked by Codegraff publication preflight (128 KiB committed-source / 256 KiB review-packet limit) despite a 23,790-byte final patch. This second case is recorded in justrach/codegraff#1304. I am leaving the PR draft rather than bypassing the gate; no new release or tag has been created.

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.

1 participant