[PR #6694] [MERGED] fix(sub): keep the spider settings in a reality spiderX seed's query #6416

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

📋 Pull Request Information

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

Base: main ← Head: fix/spiderx-keep-query


📝 Commits (2)

  • 1601524 fix(sub): keep the spider settings in a reality spiderX seed's query
  • 7442022 docs(sub): keep the deriveSpiderX comments within two lines

📊 Changes

4 files changed (+40 additions, -7 deletions)

View changed files

📝 frontend/src/lib/xray/spider-x.ts (+6 -4)
📝 frontend/src/test/spider-x.test.ts (+6 -0)
📝 internal/sub/service.go (+7 -3)
📝 internal/sub/service_sharelink_test.go (+21 -0)

📄 Description

Summary

deriveSpiderX now keeps the seed's query after the per-client path, so the spider settings Xray reads there (p, c, t, i, r) reach share links and JSON subscriptions. The frontend mirror is updated to match.

Why

Fixes #6693.

Xray's REALITY client reads p/c/t/i/r from the spiderX query as its spider's own settings and strips them before browsing (infra/conf/transport_security.go). The per-client derivation from #5718 hashed the whole seed into a bare /path, so a query set on the inbound never reached any client, and the spider always ran with defaults.

The hash input is unchanged: every existing client's spx stays exactly the same, and only seeds that carry a query gain it. Go's url.Values.Encode and the frontend's URLSearchParams escape the ?/&, so the query stays inside spx in share links.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • Cross-language vectors: two new seeds with a query, shared by TestDeriveSpiderXMatchesFrontendVectors and frontend/src/test/spider-x.test.ts.
  • New TestGenVlessLink_RealitySpiderXKeepsSpiderSettings: the link's spx decodes to /<hash>?p=…&r=…, and p/r don't leak into the link's own query.
  • Red on main, green here (screenshot below). go test -shuffle=on ./internal/sub/... and go vet pass.
  • Frontend: vitest (spider-x), oxlint, oxfmt --check and tsc --noEmit pass.
  • Real Xray: I rendered a JSON sub through GetJson on main and on this branch. The config with the kept query loads with Xray-core 26.7.28 and 26.9.9 (Configuration OK.).

Screenshots / recordings

The same inbound (spiderX /?p=40-400&c=1-4&t=1-3&i=1500-6000&r=500-2000) on main vs this branch: JSON sub, share link, and xray run -test:

spiderX before/after

The new tests on main (red), then on this branch (green):

tests red/green

Breaking changes

None. Seeds without a query produce the same spx as before.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally. (go build ./... needs the frontend dist embed; the changed package builds, vets and tests clean.)
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass. (lint, format check and typecheck run; build not run, since the change is one pure function.)
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • 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/6694 **Author:** [@FZ1010](https://github.com/FZ1010) **Created:** 9/30/2026 **Status:** ✅ Merged **Merged:** 10/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/spiderx-keep-query` --- ### 📝 Commits (2) - [`1601524`](https://github.com/MHSanaei/3x-ui/commit/1601524b71dfc0d420fed0bdb1bc59c32b0fd941) fix(sub): keep the spider settings in a reality spiderX seed's query - [`7442022`](https://github.com/MHSanaei/3x-ui/commit/7442022b6e22e0ed7bde9fec78134fdd7eb2dffa) docs(sub): keep the deriveSpiderX comments within two lines ### 📊 Changes **4 files changed** (+40 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/xray/spider-x.ts` (+6 -4) 📝 `frontend/src/test/spider-x.test.ts` (+6 -0) 📝 `internal/sub/service.go` (+7 -3) 📝 `internal/sub/service_sharelink_test.go` (+21 -0) </details> ### 📄 Description ## Summary `deriveSpiderX` now keeps the seed's query after the per-client path, so the spider settings Xray reads there (`p`, `c`, `t`, `i`, `r`) reach share links and JSON subscriptions. The frontend mirror is updated to match. ## Why Fixes #6693. Xray's REALITY client reads `p`/`c`/`t`/`i`/`r` from the spiderX query as its spider's own settings and strips them before browsing (`infra/conf/transport_security.go`). The per-client derivation from #5718 hashed the whole seed into a bare `/path`, so a query set on the inbound never reached any client, and the spider always ran with defaults. The hash input is unchanged: every existing client's `spx` stays exactly the same, and only seeds that carry a query gain it. Go's `url.Values.Encode` and the frontend's `URLSearchParams` escape the `?`/`&`, so the query stays inside `spx` in share links. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [x] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - **Cross-language vectors:** two new seeds with a query, shared by `TestDeriveSpiderXMatchesFrontendVectors` and `frontend/src/test/spider-x.test.ts`. - **New `TestGenVlessLink_RealitySpiderXKeepsSpiderSettings`:** the link's `spx` decodes to `/<hash>?p=…&r=…`, and `p`/`r` don't leak into the link's own query. - **Red on `main`, green here** (screenshot below). `go test -shuffle=on ./internal/sub/...` and `go vet` pass. - **Frontend:** `vitest` (spider-x), `oxlint`, `oxfmt --check` and `tsc --noEmit` pass. - **Real Xray:** I rendered a JSON sub through `GetJson` on `main` and on this branch. The config with the kept query loads with Xray-core 26.7.28 and 26.9.9 (`Configuration OK.`). ## Screenshots / recordings The same inbound (spiderX `/?p=40-400&c=1-4&t=1-3&i=1500-6000&r=500-2000`) on `main` vs this branch: JSON sub, share link, and `xray run -test`: ![spiderX before/after](https://raw.githubusercontent.com/FZ1010/3x-ui/c049d18e85a97cba1bbfda12ffb14780b81ce604/spiderx-before-after.png) The new tests on `main` (red), then on this branch (green): ![tests red/green](https://raw.githubusercontent.com/FZ1010/3x-ui/c049d18e85a97cba1bbfda12ffb14780b81ce604/tests-red-green.png) ## Breaking changes None. Seeds without a query produce the same `spx` as before. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. (`go build ./...` needs the frontend `dist` embed; the changed package builds, vets and tests clean.) - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. (lint, format check and typecheck run; `build` not run, since the change is one pure function.) - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. - [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:08:37 +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#6416
No description provided.