Skip to content

fix: mitigate SSRF vulnerability (CWE-918)#8

Open
mihajlo-jovanovic wants to merge 1 commit intoHyaxia:mainfrom
mihajlo-jovanovic:fix/ssrf-cwe-918
Open

fix: mitigate SSRF vulnerability (CWE-918)#8
mihajlo-jovanovic wants to merge 1 commit intoHyaxia:mainfrom
mihajlo-jovanovic:fix/ssrf-cwe-918

Conversation

@mihajlo-jovanovic
Copy link
Copy Markdown

Introduce internal/safeclient package that DNS-resolves hostnames before connecting and rejects IPs in private/reserved CIDR ranges (loopback, RFC 1918, link-local, cloud metadata endpoints).

Replace all direct http.Client.Get calls in scraper.go and rss.go with safeclient.SafeGet. Add 8 new unit tests for the safeclient package. Update existing test files with TestMain hooks for httptest.NewServer compatibility.

Introduce internal/safeclient package that DNS-resolves hostnames
before connecting and rejects IPs in private/reserved CIDR ranges
(loopback, RFC 1918, link-local, cloud metadata endpoints).

Replace all direct http.Client.Get calls in scraper.go and rss.go
with safeclient.SafeGet. Add 8 new unit tests for the safeclient
package. Update existing test files with TestMain hooks for
httptest.NewServer compatibility.
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.

1 participant