Skip to content

fix: validate WebSocket 101 acceptance before bridging - #14

Merged
abruption merged 5 commits into
mainfrom
fix/websocket-handshake
Oct 14, 2026
Merged

abruption merged 5 commits into
mainfrom
fix/websocket-handshake

Conversation

@abruption

@abruption abruption commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Fixes #6

Stacked on PR #13 (setup deadlines and cleanup); review/merge #13 first, then retarget this PR to main if GitHub does not do so automatically. This diff only adds handshake verification and fixture/regression updates.

Retain each random request key and validate the RFC 6455 Accept hash, structured HTTP/1.1 status, case-insensitive Upgrade and Connection fields, requested subprotocol, and absence of unrequested extensions. Reject duplicate Accept/subprotocol, malformed headers, folded fields, and misleading status text. Invalid 101 responses release neither downstream 101/payload nor client payload and start no frame worker. Non-101 HTTP/1.0 and HTTP/1.1 rejections remain forwarded. Status controls and non-ASCII Connection-token whitespace are rejected.

Fixtures now derive valid Accept from the actual outbound request nonce. Coverage includes the RFC known vector, missing/wrong/duplicate headers, unexpected subprotocol/extensions, header case, Connection token lists/repeated fields, optional subprotocol, control/DERP payload, ping/pong, close/EOF and long-lived streams. Based on RFC 6455 section 4.1: https://www.rfc-editor.org/rfc/rfc6455.html#section-4.1

Local: 38 focused shim tests pass. Full 71-test suite: 70 pass, one existing AF_UNIX sandbox restriction. CI runs Python 3.11/3.13 and ShellCheck. No live installation, proxy, credentials, network or deployment changes.

Verified CI on head 9e0e49ce1576a50b02c108fc8d9e2d9054aca5c1: Python 3.11 and 3.13, 71 tests each, plus Bash syntax and ShellCheck passed. Workflow run.

Codex review follow-up

The Python 3.8 compatibility finding is fixed with a guarded SHA-1 keyword fallback. Fixtures exercise old and modern constructors; timeout assertions account for Python 3.8's distinct socket.timeout class. All 40 focused shim tests pass on actual Python 3.8.20 and 3.13.7. Base is now main after PR #13 was merged; no unrelated transport changes were added. Latest head has been submitted for another Codex review.

@abruption
abruption marked this pull request as ready for review October 14, 2026 12:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T12:47:11.066449Z eba4efb Manual request
🔒 Security Review ✅ Completed 2026-10-14T12:48:44.843621Z eba4efb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@abruption
abruption changed the base branch from fix/setup-deadlines to main October 14, 2026 12:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e0e49ce15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shim.py Resolved
@abruption

Copy link
Copy Markdown
Owner Author

@codex review

@abruption

Copy link
Copy Markdown
Owner Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: eba4efb8f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: eba4efb8f9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@abruption
abruption merged commit 7afbf6d into main Oct 14, 2026
7 checks passed
@abruption abruption mentioned this pull request Oct 14, 2026
@abruption
abruption deleted the fix/websocket-handshake branch October 14, 2026 13:05
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.

fix: WebSocket 101 응답의 Accept·Upgrade 헤더를 검증

1 participant