Skip to content

fix(proxy): bound SOCKS5 TLS handshake lifetime - #7056

Closed
lcxhh521 wants to merge 1 commit into
lidge-jun:devfrom
lcxhh521:fix/socks5-tls-deadline-20261013
Closed

lcxhh521 wants to merge 1 commit into
lidge-jun:devfrom
lcxhh521:fix/socks5-tls-deadline-20261013

Conversation

@lcxhh521

@lcxhh521 lcxhh521 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Give HTTPS-over-SOCKS5 its own absolute 30-second TLS handshake deadline after SOCKS CONNECT. Previously, the SOCKS timer was cleared before TLS setup and the response timer began only after TLS succeeded, leaving a stalled handshake dependent on caller cancellation.
  • Clear the deadline and handshake listeners on success, failure, cancellation and premature close; preserve certificate verification and the caller's abort reason.
  • Add five focused native Bun regression cases, register the new test in both layout maps, and document the transport deadline.

This is a narrow shared-transport reliability fix. It does not change Desktop UI, account or quota admission, automatic readiness/fallback, certificate trust, or system proxy settings. It does not implement or close #6381 or #5947.

Verification

The publication preflight found dev two unrelated commits ahead at a29cb3d; none of the six changed paths differ, and this draft retains the exact tested base below.

Validated on Linux with Bun 1.4.3 (c6da4a4d3), based on dev daf323d:

  • bun test tests/lib/socks5-tls-lifecycle.test.ts tests/lib/socks5-upload-lifecycle.test.ts tests/test-layout.test.ts: 16 passed, zero failures. Tests ran from the repository root with the normal preload and disposable test homes.
  • node_modules/.bin/tsc --noEmit: passed.
  • node_modules/.bin/tsc --ignoreConfig --noEmit --strict --skipLibCheck --target ESNext --module ESNext --moduleResolution bundler --types bun-types tests/lib/socks5-tls-lifecycle.test.ts: passed.
  • bun scripts/privacy-scan.ts: passed.
  • bun scripts/structure-ssot.ts: passed.
  • Docs Astro build: passed, 569 pages and 79,403 internal links checked.
  • git diff --check: passed.
  • Red-before evidence: the new stalled-TLS test fails against pristine source because no TLS deadline remains after ClientHello; it passes with the fix. The deadline is triggered deterministically only after the loopback peer actually receives TLS bytes.

An expanded raw-transport run also passed both SOCKS null-body cases but failed three unchanged pinned-HTTP cases: a 204 first-byte timeout and 205/200 responses returning 502. The 204 and 200 failures reproduce on pristine current dev before applying this patch; the 205 failure reproduces on pristine dev20cd561, and its test and pinned transport are unchanged between those bases. The underlying baseline failure remains unresolved.

The full suite and broad import-graph suite were not run: this isolated validation is limited to reviewed synthetic/loopback transport fixtures, and the broader graph includes live-provider/account paths. Full socks5-fetch.test.ts, cross-platform runs and CI remain outstanding. Focused results are not a full-suite or merge-readiness claim.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Keep this PR in draft pending maintainer/security review, required exact-head CI and completion of the repository's review-readiness checks. Certificate verification remains enabled; no authentication or proxy credential behavior is intentionally changed.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

- Add an absolute TLS handshake deadline and common lifecycle cleanup
- Preserve certificate verification and caller cancellation reasons
- Cover timeout, abort, peer close and protocol errors with native fixtures
- Document the deadline and register focused regression coverage
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ⬜ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

lidge-jun added a commit that referenced this pull request Oct 13, 2026
…7055, #7056, #6925) (#7065)

* fix(chatgpt): preserve launcher when app inspection fails

Carries #7055. Report unknown inspection state and refuse an unconfirmed restart.

Co-authored-by: lcxhh <lcxhh521@gmail.com>

* fix(proxy): bound SOCKS5 TLS handshake lifetime

Carries #7056. Clear deadline and listeners on every TLS handshake exit while keeping certificate verification.

Co-authored-by: lcxhh <lcxhh521@gmail.com>

* docs: triage exceeded-retry-limit 429 errors

Carries #6925. Align refresh release conditions and the resolved credit rediscovery reference with current dev.

Co-authored-by: Howard-Jerry <197214646+Howard-Jerry@users.noreply.github.com>

---------

Co-authored-by: JUN <243035832+lidge-jun@users.noreply.github.com>
Co-authored-by: lcxhh <lcxhh521@gmail.com>
Co-authored-by: Howard-Jerry <197214646+Howard-Jerry@users.noreply.github.com>
@lidge-jun

Copy link
Copy Markdown
Owner

Thanks @lcxhh521! This change landed on dev in #7065 (1edd55a), carried unchanged in its own commit with you credited in a Co-authored-by trailer. The fork PR never got the repository's main CI, so I carried it onto an upstream branch to run it. Closing this PR because the carry superseded it.

@lidge-jun lidge-jun closed this Oct 13, 2026
lidge-jun added a commit that referenced this pull request Oct 13, 2026
…top Bad credentials (#7053, #7054) (#7062)

* fix(kiro): accept authorized social device grants

Carries #7053. Preserve token, profile, principal, and HTTP validation.

Co-authored-by: Veritas-7 <234569343+Veritas-7@users.noreply.github.com>

* fix(kiro): quarantine exact desktop bad-credentials refusals

Carries #7054. Keep AWS SSO and other status/message pairs retryable.

Co-authored-by: Veritas-7 <234569343+Veritas-7@users.noreply.github.com>

* fix(chatgpt): preserve launcher when app inspection fails

Carries #7055. Report unknown inspection state and refuse an unconfirmed restart.

Co-authored-by: lcxhh <lcxhh521@gmail.com>

* fix(proxy): bound SOCKS5 TLS handshake lifetime

Carries #7056. Clear deadline and listeners on every TLS handshake exit while keeping certificate verification.

Co-authored-by: lcxhh <lcxhh521@gmail.com>

* docs: triage exceeded-retry-limit 429 errors

Carries #6925. Align refresh release conditions and the resolved credit rediscovery reference with current dev.

Co-authored-by: Howard-Jerry <197214646+Howard-Jerry@users.noreply.github.com>

---------

Co-authored-by: JUN <243035832+lidge-jun@users.noreply.github.com>
Co-authored-by: Veritas-7 <234569343+Veritas-7@users.noreply.github.com>
Co-authored-by: lcxhh <lcxhh521@gmail.com>
Co-authored-by: Howard-Jerry <197214646+Howard-Jerry@users.noreply.github.com>
Co-authored-by: jun <jun@juns-Mac-Studio.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants