Skip to content

fix(http): strict-mode SSRF guard (#4420) and docs (#4423) - #4424

Open
stevenvegt wants to merge 3 commits into
V6.2from
backport-4420-v6.2
Open

fix(http): strict-mode SSRF guard (#4420) and docs (#4423)#4424
stevenvegt wants to merge 3 commits into
V6.2from
backport-4420-v6.2

Conversation

@stevenvegt

Copy link
Copy Markdown
Member

What

Backport of #4420 (strict-mode SSRF dial guard) and #4423 (deployment documentation) to V6.2, as two cherry-picked commits.

  • SSRF dial guard on the shared outbound HTTP transport: blocks connections to non-public addresses (full IANA special-purpose registries, IPv4 and IPv6) in strict mode, checked against the resolved IP so DNS rebinding cannot bypass it. Cloud metadata endpoints are always blocked (OWASP SSRF prevention cheat sheet). Redirect downgrades from HTTPS to HTTP are refused.
  • New config options http.client.allowedinternalcidrs and http.client.deniedcidrs (denied takes precedence; the built-in metadata blocks cannot be re-admitted).
  • Deployment documentation section "Outbound HTTP and SSRF protection" in security considerations, linked from the release notes entry.

Conflict resolution notes

The code applied cleanly. Conflicts were limited to:

  • go.mod/go.sum: re-added the test-only dependency code.dny.dev/ssrf v0.3.0 (drift test against the IANA registries) on top of the V6.2 dependency set.
  • docs/pages/deployment/server_options.rst: regenerated with go run ./docs docs (column widths reflow, so the textual diff is large; content-wise only the two new options are added).
  • docs/pages/release_notes.rst: added an Unreleased section containing only the fix(http): block SSRF to non-public addresses in strict mode #4420 security bullet.

Testing

  • go build ./... and go test ./http/... pass locally on this branch, including the drift test and the engine-level config plumbing tests.

Fixes potential SSRF vulnerability by preventing the internal http client of connecting to a curated IANA list of prohibited (internal) endpoints/ip ranges.

This check is executed at the transport layer just after IP lookup so we don't rely on DNS.

An administrator has the config options to allow or deny additional ip ranges.

See #4420 for additional info.

Assisted-by: AI
Add an SSRF section to the security considerations page explaining the
strict-mode outbound guard and how to configure allowedinternalcidrs and
deniedcidrs in production. Link to it from the release notes entry.

Assisted-by: AI
@qltysh

qltysh Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

0 new issues

Tool Category Rule Count

* test(storage): fix flaky minimemcached nil-pointer panic

The minimemcached test server spawns a goroutine that calls Accept() on
its listener, while Close() nils that listener. On very short tests the
cleanup's Close() could run before the goroutine entered Accept(),
dereferencing a nil listener inside the dependency and crashing the test
binary with a panic that no test can recover (it runs in a foreign
goroutine).

Block in the test helper until the server answers a probe connection,
guaranteeing the accept loop is parked in Accept() before the test
proceeds. Close() then unblocks it cleanly instead of racing startup.

Assisted by AI

* test(storage): link upstream issue for the minimemcached workaround

Reference daangn/minimemcached#14 (fix in PR
#13) so the workaround can be removed once an upstream release ships the
fix.

Assisted by AI
@qltysh

qltysh Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on V6.2 by 0.1%.

Modified Files with Diff Coverage (4)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
http/engine.go100.0%
Coverage rating: A Coverage rating: A
http/cmd/cmd.go100.0%
Coverage rating: B Coverage rating: A
http/client/client.go92.0%80-81
New Coverage rating: A
http/client/ssrf.go97.0%197-198
Total96.2%
🤖 Increase coverage with AI coding...
In the `backport-4420-v6.2` branch, add test coverage for this new code:

- `http/client/client.go` -- Line 80-81
- `http/client/ssrf.go` -- Line 197-198

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@stevenvegt stevenvegt changed the title Backport: strict-mode SSRF guard (#4420) and docs (#4423) to V6.2 fix(http): strict-mode SSRF guard (#4420) and docs (#4423) Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants