Skip to content

feat(proxy-subscription): verify the generated core configuration before replacing the file - #15142

Closed
maxmad64bis wants to merge 2 commits into
cheaper-inference:release/v3.8.52from
maxmad64bis:feat/core-config-verify
Closed

maxmad64bis wants to merge 2 commits into
cheaper-inference:release/v3.8.52from
maxmad64bis:feat/core-config-verify

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #15141. Only the last commit is this PR's; I'll rebase once it lands.

⚠️ base-red inherited: #15306

Summary

An unchecked replacement can ship a broken core file. The core now checks the generated file with its own binary first: a pass swaps it in atomically, a miss leaves the adopted file alone and raises a warning instead.

Related Issues

Validation

  • Change type: provider
  • Focused tests and category gates from the golden path
  • npm run lint — ESLint on the touched files is clean; the full run is red on the base (🔴 Release branch not green: release/v3.8.52 #15306)
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/proxySubscription.coreApply.test.ts (new, 21 tests: missing/unreadable binary with no execution, passing and failing native checks, slow binary killed on timeout, read-only target, identical content, trapped path as one argument, injected rename faults, preserved file mode)
  • tests/unit/proxySubscription.coreConfigSync.test.ts (new cases: verify branch through the native check, each new case fails without the change, side-files removal on delete)
  • tests/unit/proxy-subscriptions-route-validation.test.ts (new cases: binary path validation on create and update)
  • Attack paths in tests (/tmp/attacker/sing-box as refused coreBinaryPath) are intentional refusal proofs, not real paths.

Coverage Notes

  • src/lib/proxySubscription/coreConfig/apply.ts — covered by proxySubscription.coreApply.test.ts and proxySubscription.coreConfigSync.test.ts (branch + removal)
  • src/lib/proxySubscription/coreConfig/sync.ts — covered by proxySubscription.coreConfigSync.test.ts (verify branch, each new case fails without the change)
  • src/lib/proxySubscription/coreConfig/pathGuard.ts — covered by proxySubscription.coreApply.test.ts and proxy-subscriptions-route-validation.test.ts
  • src/lib/proxySubscription/subscriptionService.ts, src/lib/proxySubscription/schema.ts — covered by proxySubscription.coreApply.test.ts and proxy-subscriptions-route-validation.test.ts
  • src/app/(dashboard)/dashboard/settings/components/proxy/SubscriptionTab.tsx — covered indirectly through the subscription routes

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the feat/core-config-verify branch from 36f4041 to dacc2b1 Compare September 29, 2026 20:32
@maxmad64bis
maxmad64bis force-pushed the feat/core-config-verify branch 2 times, most recently from e5f05d7 to d2aa381 Compare September 30, 2026 00:08
@maxmad64bis
maxmad64bis marked this pull request as ready for review September 30, 2026 00:08
@maxmad64bis
maxmad64bis marked this pull request as draft October 1, 2026 22:35
@maxmad64bis
maxmad64bis force-pushed the feat/core-config-verify branch from d2aa381 to 03ddc5a Compare October 2, 2026 00:08
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 2, 2026 08:59
@maxmad64bis
maxmad64bis force-pushed the feat/core-config-verify branch from 559a830 to e680e64 Compare October 2, 2026 15:07
…ore replacing the file

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@maxmad64bis
maxmad64bis force-pushed the feat/core-config-verify branch from 02062c6 to e159038 Compare October 4, 2026 13:27
@maxmad64bis

Copy link
Copy Markdown
Contributor Author

Closing as already covered by #15564, now on release/v3.8.52.

The stack (#15141, #15142, #15238, #15295) was squashed there: src/lib/proxySubscription/coreConfig/{model,renderers,singbox,sync,apply,reload}.ts, the changelog fragments for these PRs and the matching proxySubscription.core*.test.ts suites are on the tip, with later changes on top. What this branch adds is already merged, so it can only conflict with the tip now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant