Repository navigation
fix(security): only skip evaluation for genuine WebSocket upgrades - #1
Draft
telmolivella2 wants to merge 1 commit into
Draft
telmolivella2 wants to merge 1 commit into
telmolivella2 wants to merge 1 commit into
Conversation
is_websocket_upgrade accepted any request with `Connection: Upgrade` and any `Upgrade` value, letting a normal POST bypass request and response evaluation. Require `Upgrade: websocket` (case-insensitive) and a `Sec-WebSocket-Key` header, per RFC 6455. Adds unit tests for spoofed upgrade headers and updates the existing upgrade tests accordingly. Refs ENG-3374 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Vulnerability (High, ENG-3374): this customer-shipped MuleSoft flex policy treated any request with
Connection: Upgradeplus anyUpgradeheader as a WebSocket upgrade and skipped both request and response evaluation (is_websocket_upgrade,src/lib.rs). A caller could addConnection: Upgrade+Upgrade: h2cto a normal POST and bypass the guardrail.Fix (minimal):
is_websocket_upgradenow requires theupgradetoken inConnection,Upgrade: websocket(case-insensitive, trimmed) and aSec-WebSocket-Key, as RFC 6455 does. Existing positive tests and the integration test request gain thesec-websocket-keyheader so they keep covering the real skip.Base:
main(nodevelopin this repo). Linear: ENG-3374How tested
Upgrade: h2c→ not websocket; websocket without key → not websocket;Upgrade: WebSocketwith key → websocket).cargo test --libwith a local stable toolchain (no CI in this repo): base with the new tests 105 passed / 2 failed (the two negative cases); branch 107 passed / 0 failed.cargo clippy --all-targets: the same 3 pre-existing warnings before and after.#[pdk_test]integration tests (need Docker, the Flex Gateway image andregistration.yaml) andcargo fmt(rustfmt not installed).nt-pre-pr-checkmake testfails identically on main (needsanypoint-cli-v4/cargo anypoint).Type of Change
feat— New feature → minor bumpfix— Bug fix → patch bumprefactor— Code restructuring (no behavior change) → patch bumpdocs— Documentation → patch bumptest— Tests → patch bumpci— CI/CD changes → patch bumpchore— Maintenance → patch bump!) → major bumpChecklist
type(scope): descriptionformatMerge Reminder
🤖 Generated with Claude Code