feat: add internal/fetch package with SSRF-protected HTTP client - #1096
Conversation
Site previewPreview: https://0eeb1852-site.fullsend-ai.workers.dev Commit: |
ReviewFindingsNo findings. Previous runReviewFindingsLow
Previous run (2)ReviewFindingsMedium
Low
Previous run (3)ReviewFindingsInfo
No blocking findings. The implementation is a well-structured SSRF-hardened HTTP fetcher with comprehensive security controls (HTTPS-only, domain allowlist, DNS pre-resolution, IP validation, transport-level IP pinning, redirect blocking, size limits, double-encoding rejection) and thorough test coverage (22 IP classification cases, 10 fetch scenarios). Previous run (4)ReviewFindingsInfo
No blocking findings. All three low-severity findings from the prior review have been addressed in this revision:
Previous run (5)ReviewFindingsInfo
No blocking findings. All three low-severity findings from the prior review have been addressed in this revision:
Previous runReviewFindingsLow
Info
Previous run (6)ReviewFindingsInfo
No blocking findings. All three low-severity findings from the prior review have been addressed in this revision:
Previous run (7)ReviewFindingsLow
Info
|
Review follow-upsCreated follow-up issues for actionable non-blocking review findings:
Previous runReview follow-upsCreated follow-up issues for actionable non-blocking review findings:
Previous run (2)Review follow-upsWarning: follow-up issue creation is capped at 3 per review run; 1 actionable non-blocking finding(s) were not filed. Created follow-up issues for actionable non-blocking review findings:
|
|
/fs-review |
5fad560 to
2e42a46
Compare
2e42a46 to
58b93cf
Compare
58b93cf to
05faa36
Compare
05faa36 to
64e17de
Compare
Add SSRF-hardened HTTP fetcher for remote resource retrieval with domain allowlist, internal IP rejection, DNS rebinding protection, size limiting, port restriction, and no-redirect policy. Extract shared IP classification logic to internal/netutil so both internal/fetch and internal/security use a single implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Greg Allen <gallen@redhat.com>
64e17de to
6808d8b
Compare
Summary
internal/fetchpackage implementing an SSRF-hardened HTTP fetcher (ADR-0038 PR 2)Design
FetchPolicystruct controls allowed domains, max size, timeout, and offline modeFetchURLperforms the full SSRF-safe fetch pipeline: offline check, HTTPS-only,%25rejection, domain allowlist, DNS resolution, IP validation, pinned dial, no redirects, 200-only, size limitisInternalIPnormalizes IPv4-mapped IPv6 and checks loopback/private/link-local/unspecified/multicast plus CIDRs for 0.0.0.0/8, 100.64.0.0/10, 198.18.0.0/15ComputeSHA256utility for content integrity verificationTest plan
TestFetchURLsubtests: HTTPSOnly, DomainAllowlist, WildcardDomain, NoRedirects, SizeLimit, Timeout, OfflineMode, DoubleEncoding, NonOKStatus, SuccessTestIsInternalIP: loopback, RFC1918, link-local, CGNAT, benchmark, unspecified, multicast, IPv4-mapped IPv6, public IPs (22 cases)TestComputeSHA256: known-value verificationgo test -race -vet=all ./internal/fetch/...passes🤖 Generated with Claude Code