From 15feed9ea7474b9fde779c219b888cbd70e4707e Mon Sep 17 00:00:00 2001 From: Sanaei Date: Sun, 29 Nov 2026 23:37:40 +0330 Subject: [PATCH] chore(security): run the scanner's real-core tests against the go.mod core The OSS Scanner image pointed XRAY_E2E_BINARY at the release binary that DockerInit.sh downloads, while CI's `make xray-e2e` builds the core from the commit go.mod pins. The two are the same commit today (v26.11.9), but they part whenever go.mod moves to an unreleased commit, and the scanner's baseline would then run the gRPC tests against a core the panel code was not written for. The image now builds that core as xray-e2e and points the variable at it; the release binary stays as /usr/local/bin/xray, which is what a live panel runs. The comment also named two of the three packages the variable turns on. --- .oss-scanner/Dockerfile | 9 +++++++-- .oss-scanner/threat_model.md | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.oss-scanner/Dockerfile b/.oss-scanner/Dockerfile index e1956b546..d08e5489e 100644 --- a/.oss-scanner/Dockerfile +++ b/.oss-scanner/Dockerfile @@ -41,8 +41,13 @@ RUN ./DockerInit.sh "$(dpkg --print-architecture)" \ && ln -s "/src/build/bin/xray-linux-$(dpkg --print-architecture)" /usr/local/bin/xray \ && xray version -# Turns on the xray gRPC end-to-end tests (internal/xray, internal/amneziawgnet) against the real core. -ENV XRAY_E2E_BINARY=/usr/local/bin/xray +# The real-core tests get the core go.mod pins, built as `make xray-e2e` builds it in CI: +# the release binary above lags whenever go.mod moves to an unreleased commit. +RUN go build -o /usr/local/bin/xray-e2e github.com/xtls/xray-core/main \ + && xray-e2e version + +# Turns on every test gated on XRAY_E2E_BINARY (internal/xray, internal/amneziawgnet, internal/web/service). +ENV XRAY_E2E_BINARY=/usr/local/bin/xray-e2e # Baseline tests: also warms the build cache. A failure is logged, never fatal. RUN go test -count=1 -timeout 30m ./... > /src/.oss-scanner-go-test.log 2>&1 \ diff --git a/.oss-scanner/threat_model.md b/.oss-scanner/threat_model.md index aca8897f1..d53c87aa8 100644 --- a/.oss-scanner/threat_model.md +++ b/.oss-scanner/threat_model.md @@ -207,8 +207,10 @@ or the admin's browser as something other than data. ## How to exercise it - Checkout at `/src`. The panel binary is `/usr/local/bin/x-ui` (built with - `-N -l`), Xray-core is `/usr/local/bin/xray`, and the sidecars and geo - files are in `/src/build/bin`. `sqlite3`, `curl` and `jq` are installed. + `-N -l`), Xray-core is `/usr/local/bin/xray` (the release build the panel + runs), and the sidecars and geo files are in `/src/build/bin`. + `/usr/local/bin/xray-e2e` is the core built from the `go.mod` pin, which + `XRAY_E2E_BINARY` points at. `sqlite3`, `curl` and `jq` are installed. There is no network; `GOPROXY=off` and npm is offline. - Go tests: `cd /src && go test -count=1 ./...`. Real-DB helpers live in `internal/database/dbtest` (`dbtest.InitDB(t, path)`); `internal/sub`'s