mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5396] [MERGED] fix(xray): verify the release archive checksum before installing #5870
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5870
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5396
Author: @n0ctal
Created: 6/16/2026
Status: ✅ Merged
Merged: 6/19/2026
Merged by: @MHSanaei
Base:
main← Head:pr-0004-xray-checksum📝 Commits (2)
fe44c60fix(xray): verify the release archive checksum before installingcab964eaddress review: clearer warning + re-download guidance on checksum mismatch📊 Changes
2 files changed (+134 additions, -0 deletions)
View changed files
📝
internal/web/service/server.go(+62 -0)➕
internal/web/service/server_xray_checksum_test.go(+72 -0)📄 Description
Summary
Verify the downloaded Xray-core release archive against its published
SHA2-256before installing, instead of installing it after only a TLS fetch + HTTP-200 + a size cap.Why
UpdateXray→downloadXRayfetched the release zip and installed the binary from it with no integrity check on the artifact itself. TLS protects the transport, not the bytes: a corrupted or tampered release asset (a bad mirror/CDN, or a proxy that terminates TLS) would be extracted and run as the panel's long-lived xray process.Scope
.dgstsidecar XTLS publishes next to each asset, parse itsSHA2-256(the label isSHA2-256=, notSHA256=), compute the archive's SHA-256, and abort on mismatch.dgstis unreachable or has no/shortSHA2-256entry — fail closed, never install an unverified archive. (Maintainer note: this hard-fails updating to any release without a published.dgst; happy to switch to warn-and-proceed if you'd prefer to keep installing those.).dgstread is capped at 64 KiBValidation
.dgstline format, plus missing/malformed entries) and the fetch (httptest 200 + 404)internal/web/servicepackage tests passRisk
Low. Adds a verification step inside the existing download path; no API or behaviour change beyond rejecting an unverifiable archive.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.