[PR #6393] [MERGED] feat(release): publish SHA-256 sums and verify them in install.sh/update.sh #6248

Closed
opened 2026-11-02 04:07:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6393
Author: @rokokol
Created: 9/2/2026
Status: ✅ Merged
Merged: 9/3/2026
Merged by: @MHSanaei

Base: main ← Head: feat/release-checksums


📝 Commits (4)

  • 5430309 feat(release): publish SHA-256 sums and verify them in install.sh/update.sh
  • 0d568b0 fix(install): fail closed when the checksum sidecar cannot be fetched
  • b849dea Merge branch 'main' into feat/release-checksums
  • ec1f4c4 fix(install): restore the closing brace lost in the main merge

📊 Changes

3 files changed (+68 additions, -8 deletions)

View changed files

📝 .github/workflows/release.yml (+16 -8)
📝 install.sh (+30 -0)
📝 update.sh (+22 -0)

📄 Description

Summary

Publish <asset>.sha256 next to every release archive (Linux tarballs and the Windows zip, including the rolling dev-latest release) and verify it in install.sh and update.sh before extracting.

Why

The installer and updater fetched the release archive and extracted it after checking only that the file is not empty ([[ -s ... ]]), and the release workflow published no checksums. A truncated download, a corrupted or swapped asset or a bad mirror was extracted and installed as root. #5396 added the same verification for the Xray-core archive the panel downloads; the panel's own archive was the remaining unverified download.

Scope of the guarantee, stated plainly: the sidecar comes from the same host over the same channel as the archive, so this catches corruption, truncation and a bad mirror; it does not defend against a party that controls the release or the TLS channel, which needs an out-of-band trust anchor (signed releases) and is out of scope here.

Scope

  • release.yml: the Linux Package step writes sha256sum output to x-ui-linux-<platform>.tar.gz.sha256; the Windows step writes the same format via Get-FileHash. Both files go to the artifacts and to the release (file_glob: true), and the publish-dev job uploads dev-artifacts/*.sha256 too.
  • install.sh: verify_release_checksum() downloads ${url}.sha256, compares it with sha256sum of the archive, deletes the archive and exits on mismatch. Only an HTTP 404 for the sidecar (every release before this change, including legacy_version installs) is tolerated with a warning; any other failure to fetch it (5xx, connection reset, DNS) aborts and removes the archive, so a party that can swap the asset cannot skip the check by dropping the sidecar request. (Maintainer note: happy to fail closed on 404 as well for tags newer than the first release that ships a sidecar, if you prefer.)
  • update.sh: same logic inline, using _fail on mismatch or fetch failure.

Type of change

  • New feature
  • Build / CI / tooling

Areas affected

  • Install / upgrade script

How was this tested?

  • verify_release_checksum() exercised against a local HTTP server with a random archive: matching sidecar passes ("Checksum verified"), 404 sidecar warns and continues, unreachable sidecar host aborts (HTTP 000) and removes the download, tampered archive fails with the expected/actual hashes and removes the download.
  • bash -n on both scripts; shellcheck -S warning warning counts unchanged against main (38 / 39); release.yml parses as YAML.
  • The workflow change itself runs only on a tag push, so it is not exercised here; the sha256sum/Get-FileHash lines and the file_glob option of svenstaro/upload-release-action are the documented forms.

Screenshots / recordings

N/A

Breaking changes

None. Releases without a .sha256 sidecar install as before, with a warning.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable). (no shell test harness in the repo)
  • go build ./... and the test suite pass locally. (no Go changes)
  • For frontend changes: N/A
  • I updated the Wiki / README / API docs if user-facing behavior changed. (none needed)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6393 **Author:** [@rokokol](https://github.com/rokokol) **Created:** 9/2/2026 **Status:** ✅ Merged **Merged:** 9/3/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/release-checksums` --- ### 📝 Commits (4) - [`5430309`](https://github.com/MHSanaei/3x-ui/commit/5430309014b35c3c8fe2972969706ad57e07f6e5) feat(release): publish SHA-256 sums and verify them in install.sh/update.sh - [`0d568b0`](https://github.com/MHSanaei/3x-ui/commit/0d568b0c80122185b4abae2e7c8e2bd51e276ca1) fix(install): fail closed when the checksum sidecar cannot be fetched - [`b849dea`](https://github.com/MHSanaei/3x-ui/commit/b849dea88d90284f74af5f0a68e43b10048f4c59) Merge branch 'main' into feat/release-checksums - [`ec1f4c4`](https://github.com/MHSanaei/3x-ui/commit/ec1f4c49aa3bd23c22c154d5d6fe1509781c9412) fix(install): restore the closing brace lost in the main merge ### 📊 Changes **3 files changed** (+68 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+16 -8) 📝 `install.sh` (+30 -0) 📝 `update.sh` (+22 -0) </details> ### 📄 Description ## Summary Publish `<asset>.sha256` next to every release archive (Linux tarballs and the Windows zip, including the rolling `dev-latest` release) and verify it in `install.sh` and `update.sh` before extracting. ## Why The installer and updater fetched the release archive and extracted it after checking only that the file is not empty (`[[ -s ... ]]`), and the release workflow published no checksums. A truncated download, a corrupted or swapped asset or a bad mirror was extracted and installed as root. #5396 added the same verification for the Xray-core archive the panel downloads; the panel's own archive was the remaining unverified download. Scope of the guarantee, stated plainly: the sidecar comes from the same host over the same channel as the archive, so this catches corruption, truncation and a bad mirror; it does not defend against a party that controls the release or the TLS channel, which needs an out-of-band trust anchor (signed releases) and is out of scope here. ## Scope - `release.yml`: the Linux `Package` step writes `sha256sum` output to `x-ui-linux-<platform>.tar.gz.sha256`; the Windows step writes the same format via `Get-FileHash`. Both files go to the artifacts and to the release (`file_glob: true`), and the `publish-dev` job uploads `dev-artifacts/*.sha256` too. - `install.sh`: `verify_release_checksum()` downloads `${url}.sha256`, compares it with `sha256sum` of the archive, deletes the archive and exits on mismatch. Only an HTTP 404 for the sidecar (every release before this change, including `legacy_version` installs) is tolerated with a warning; any other failure to fetch it (5xx, connection reset, DNS) aborts and removes the archive, so a party that can swap the asset cannot skip the check by dropping the sidecar request. *(Maintainer note: happy to fail closed on 404 as well for tags newer than the first release that ships a sidecar, if you prefer.)* - `update.sh`: same logic inline, using `_fail` on mismatch or fetch failure. ## Type of change - [x] New feature - [x] Build / CI / tooling ## Areas affected - [x] Install / upgrade script ## How was this tested? - `verify_release_checksum()` exercised against a local HTTP server with a random archive: matching sidecar passes ("Checksum verified"), 404 sidecar warns and continues, unreachable sidecar host aborts (`HTTP 000`) and removes the download, tampered archive fails with the expected/actual hashes and removes the download. - `bash -n` on both scripts; `shellcheck -S warning` warning counts unchanged against `main` (38 / 39); `release.yml` parses as YAML. - The workflow change itself runs only on a tag push, so it is not exercised here; the `sha256sum`/`Get-FileHash` lines and the `file_glob` option of `svenstaro/upload-release-action` are the documented forms. ## Screenshots / recordings N/A ## Breaking changes None. Releases without a `.sha256` sidecar install as before, with a warning. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [ ] I added or updated tests for the new behavior (when applicable). (no shell test harness in the repo) - [x] `go build ./...` and the test suite pass locally. (no Go changes) - [ ] For frontend changes: N/A - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. (none needed) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:23 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6248
No description provided.