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.
This commit is contained in:
Sanaei
2026-11-29 23:37:40 +03:30
parent 6171245fb1
commit 15feed9ea7
2 changed files with 11 additions and 4 deletions
+7 -2
View File
@@ -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 \
+4 -2
View File
@@ -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