fix(INSECURE_TRANSPORT): detect ws:// declared via top-level serverUrl#41
Open
dmchaledev wants to merge 1 commit into
Open
fix(INSECURE_TRANSPORT): detect ws:// declared via top-level serverUrl#41dmchaledev wants to merge 1 commit into
dmchaledev wants to merge 1 commit into
Conversation
INSECURE_TRANSPORT only read config.transport?.url, so a config that declares its endpoint at the top level as serverUrl: "ws://..." with no nested transport.url block passed the scan with zero findings — a false negative for a security gate on a cleartext WebSocket endpoint. MISSING_TLS already falls back to serverUrl (config.transport?.url ?? config.serverUrl); serverUrl is a documented, first-class field (examples/minimal-config.json uses it alone). Mirror that fallback here so the same endpoint is evaluated regardless of which field carries it. Adds regression tests: ws:// serverUrl fires, wss:// serverUrl does not, and transport.url still takes precedence when both are present. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RfTG58p1JL5Va5ZNKVP1Rv
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
INSECURE_TRANSPORTonly readsconfig.transport?.url, so a config that declares its endpoint at the top level asserverUrl: "ws://…"— with no nestedtransport.urlblock — passes the scan with zero findings. That is a false negative in a CI/CD security gate: an unencrypted WebSocket endpoint (auth tokens and tool payloads in cleartext) is reported as clean.serverUrlis a documented, first-class field —examples/minimal-config.jsonuses it alone with notransportblock — and the sibling ruleMISSING_TLSalready falls back to it (config.transport?.url ?? config.serverUrl,src/rules/auth-rules.ts:101).INSECURE_TRANSPORTdid not, creating an inconsistency where aws://endpoint slips through both rules:MISSING_TLSexcludes the WebSocket scheme (it's owned byINSECURE_TRANSPORT), andINSECURE_TRANSPORTnever looked atserverUrl.Repro (built CLI, before this change)
The identical config with the URL duplicated under
transport.urlcorrectly firesINSECURE_TRANSPORT. After this change both forms fire.Fix
One-line change in
src/rules/runtime-rules.ts: readconfig.transport?.url ?? config.serverUrl, mirroringMISSING_TLS. No behavior change for configs that settransport.url(it still takes precedence).Tests
Adds three regression tests to the
INSECURE_TRANSPORTsuite:ws://serverUrlwith notransport.url→ fires (HIGH)wss://serverUrlwith notransport.url→ does not firetransport.urltakes precedence (evidence reflects it)npm run typecheck,npm run lint, andnpm testall pass (121 tests).Scope
Independent of the open backlog — no open issue or PR touches
INSECURE_TRANSPORT'sserverUrlfallback (#18 concerns theMISSING_TLSwss://false positive, a different direction).🤖 Generated with Claude Code
https://claude.ai/code/session_01RfTG58p1JL5Va5ZNKVP1Rv
Generated by Claude Code