Add tls-verification-disabled matcher - #148
Open
Steel-tech wants to merge 3 commits into
Open
Conversation
Detects disabled TLS certificate/hostname verification (CWE-295) across Node (rejectUnauthorized, NODE_TLS_REJECT_UNAUTHORIZED, strictSSL), Go (InsecureSkipVerify), Python (verify=False, unverified context, check_hostname), Ruby (VERIFY_NONE), JVM (permissive verifiers), PHP (CURLOPT_SSL_VERIFY*), .NET (validation callback bypass), curl/wget/git CLI flags, and connection strings (sslmode=disable, tls=skip-verify, insecure-skip-tls-verify). Every regex anchors to the explicit disable form so enabled configurations never match. Skips test files across ecosystems, since the scan-level ignore list only covers JS-style test paths.
Real-repo validation showed the bare `verify=False` pattern firing on unrelated kwargs (jwt.decode, numpy dispatch, mpmath.findroot). Require a requests/httpx/session token or an HTTP-verb call on the same line so the pattern only matches TLS verification bypass.
Contributor
|
@Steel-tech is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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.
What changed
Adds a new built-in matcher,
tls-verification-disabled, that flags code which explicitly disables TLS certificate or hostname verification (CWE-295) across the ecosystems deepsec already scans.Why
There was no built-in coverage for disabled TLS verification — no matcher referenced
rejectUnauthorized,InsecureSkipVerify,verify=False,VERIFY_NONE,sslmode=disable, orcurl -k. It's a high-signal, cross-language weakness class, so a single ungated matcher fills the gap in one place. Every pattern anchors to the explicit disable form (false/0/disable/skip-verify), so verification-enabled configurations never match.Covered idioms: Node (
rejectUnauthorized: false,NODE_TLS_REJECT_UNAUTHORIZED=0,strictSSL: false), Go (InsecureSkipVerify: true), Python (requests/httpxverify=False,ssl._create_unverified_context,check_hostname = False), Ruby (VERIFY_NONE), JVM (permissive hostname verifiers / trust-all strategy), PHP (CURLOPT_SSL_VERIFY*off), .NET (validation-callback bypass), curl/wget/git CLI flags, and connection strings (sslmode=disable,tls=skip-verify,insecure-skip-tls-verify).Verification
pnpm testpasses (2390 unit tests, including the auto-discoveredmatcher-examplessuite — every one of the matcher's sub-patterns is exercised by an inline example)pnpm lintpassespnpm knippassespnpm -r buildpassespnpm test:bundlepasses (28 tests) — a registered matcher compiles intodist/config.mjsviacreateDefaultRegistry, so it's part of the publish surfaceReal-repo candidate counts (
pnpm deepsec scan --matchers tls-verification-disabled):rejectUnauthorized: false).check_hostname = Falsein DB/index scripts, a NoderejectUnauthorized: false, acurl -kin a shell script). A further 14 candidates were inside vendoredvenv/site-packages/(urllib3/httpx internals) — genuine matches, filtered by ordinary project ignore config rather than by the matcher.Notes for reviewer
precise— the matched syntax is itself a strong signal. During validation, the initialverify=Falsepattern over-fired on unrelated kwargs (jwt.decode(..., verify=False),numpydispatch,mpmath.findroot), so it's now anchored to arequests/httpx/session/HTTP-verb call context on the same line. That's the one deliberate precision/recall trade: averify=Falsesplit across lines from its request call won't match.insecure-cryptoexcludes only JS-style.test./.spec.paths; this matcher also excludes_test.go,test_*.py/*_test.py,conftest.py,_spec.rb, andspec/dirs, since the scan-levelIGNORE_DIRSonly pre-excludes the JS conventions and this matcher is deliberately multi-language.filePatternsnames dot-path targets explicitly (.github/workflows/,**/.env,**/Dockerfile) because the scan glob doesn't traverse dot-paths by default — mirroringgithub-workflow-security,env-exposure, and thedockerfile-*matchers.crypto-usage: Gotls.Config{...}lines are also picked up bycrypto-usage's wide-net "Go TLS op" pattern. Different tiers and purposes (wide-net-for-AI vs. precise disable signal), so this is additive, not a conflict — flagging in case you'd prefer a note or de-dup.fixtures/vulnerable-appif you'd like the matcher exercised by the fixture-based tests too — left it out to keep the diff to matcher + unit tests.