Disable TLS certificate verification in crawler allows MITM/SSRF#2052
Open
omnipotentchaos wants to merge 2 commits into
Open
Disable TLS certificate verification in crawler allows MITM/SSRF#2052omnipotentchaos wants to merge 2 commits into
omnipotentchaos wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses Issue #1747 by hardening the crawler’s HTTP client configuration to prevent MITM risk from disabled TLS verification and to mitigate redirect-based SSRF by disallowing cross-host redirects.
Changes:
- Adds a new
tls_verifysetting (env:SECUSCAN_TLS_VERIFY) and documents it in.env.example. - Updates
crawl_target()to useverify=tls_verifyand disables automatic redirects in favor of an explicit same-host redirect policy. - Adds new unit tests covering TLS verification usage and redirect allow/block behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
backend/secuscan/crawler.py |
Enforces TLS verification via config and replaces follow_redirects=True with a same-host redirect loop. |
backend/secuscan/config.py |
Introduces tls_verify setting to control crawler TLS verification behavior. |
.env.example |
Documents SECUSCAN_TLS_VERIFY for configuration discoverability. |
testing/backend/unit/test_crawler_security.py |
Adds unit tests for TLS verify wiring and cross-host redirect blocking policy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Description
This PR resolves a security vulnerability in
crawler.pywherehttpx.AsyncClientwas configured withverify=Falseandfollow_redirects=True, allowing Man-in-the-Middle (MITM) attacks and redirect-based Server-Side Request Forgery (SSRF) to arbitrary internal/external endpoints.Key changes:
tls_verify: bool = Trueconfiguration setting (SECUSCAN_TLS_VERIFYenv var) inconfig.pyand documented it in.env.example.httpx.AsyncClientincrawler.pyto enforce TLS verification (verify=tls_verify).response.historytracking for valid same-host redirect chains.Related Issues
Fixes #1747
Type of Change
How Has This Been Tested?
Ran backend unit tests covering the crawler security policy and helper functions: