[AUDIT-FULL-C3] Verify SHA-256 checksum of TON-proxy binary before execution#332
[AUDIT-FULL-C3] Verify SHA-256 checksum of TON-proxy binary before execution#332xlabtg merged 4 commits intoxlabtg:mainfrom
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#308
…cutable Pin the Tonutils-Proxy release tag in checksums.json and verify the downloaded binary's SHA-256 digest before chmod +x is called. Also validate Content-Length (≤ 50 MB), reject cross-domain redirects, and delete the partial file on any verification failure without auto-retry. Closes xlabtg#308
Solution summaryAll done. Here's a summary of what was implemented: PR #332 — [AUDIT-FULL-C3] Verify SHA-256 checksum of TON-proxy binary before execution What changed
Full test suite: 3073 tests across 151 files — all green. This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $2.562948📊 Context and tokens usage:
Total: (71.7K + 6.3M cached) input tokens, 26.3K output tokens, $2.562948 cost 🤖 Models used:
📎 Log file uploaded as Gist (2747KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (iteration 1)Reason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $0.514923📊 Context and tokens usage:
Total: (48.0K + 963.8K cached) input tokens, 3.1K output tokens, $0.514923 cost 🤖 Models used:
📎 Log file uploaded as Gist (3434KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 94af9fc.
Summary
Fixes #308
The
install()method insrc/ton-proxy/manager.tspreviously downloaded the Tonutils-Proxy binary from GitHub Releases with no integrity verification — no checksum, no size limit, no redirect-domain check. A compromised upstream account or MITM on an anonymous download would silently install malicious code with wallet-owner privileges.Changes
src/ton-proxy/checksums.json(new)Pins the release tag (
v1.8.3) and stores SHA-256 digests for every supported platform binary:tonutils-proxy-cli-linux-amd648df4974e...tonutils-proxy-cli-darwin-amd64ae9e85bc...tonutils-proxy-cli-darwin-arm64d8d47207...tonutils-proxy-cli-windows-amd64.exe4a3ef279...src/ton-proxy/manager.tschecksums.json, not the floating/releases/latestAPI.github.comorobjects.githubusercontent.com; anything else aborts immediately.checksums.jsonbeforechmod +xis ever called.src/ton-proxy/__tests__/manager.test.ts(new)5 unit tests covering all new security checks:
chmodSynccalledchecksum mismatch,chmodSyncnever calledContent-Length→ throws before streamingdocs/ton-wallet.mdNew TON Proxy Binary Verification section documents the pinned tag, what is verified, failure behaviour, and how to upgrade the binary.
Acceptance criteria
latest)checksums.jsonfor all supported platforms lives next to the managerpipeline, beforechmod +xinstall()aborts beforechmod +xdocs/ton-wallet.mddescribes the verification processTest plan
All 5 new tests pass; full suite (151 files, 3073 tests) is green with no regressions.