Skip to content

Skip recording DNS noise for all IP literals with no pending port - #330

Merged
hansott merged 1 commit into
mainfrom
fix/skip-recording-ip-literals-without-port
Aug 3, 2026
Merged

Skip recording DNS noise for all IP literals with no pending port#330
hansott merged 1 commit into
mainfrom
fix/skip-recording-ip-literals-without-port

Conversation

@Mishenevd

@Mishenevd Mishenevd commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #325, which only skipped private IP literals. The same dashboard noise happens with public ones.

Spring Security's IpAddressMatcher (and similar inbound access-control code) parses request IPs via InetAddress.getByName, which lands in our getAllByName sink with no pending port. So inbound client IPs — private or public — get recorded as outbound connections. This is the case reported in #294.

The change is a one-liner: in the no-pending-port branch, record a hit only when the hostname isn't a literal IP (IPValidator.isIP) instead of only skipping private ones. A literal IP with no port is usually inbound IP parsing rather than an outbound request, and we can't tell the two apart at this sink — so we skip it (see the trade-off below).

Everything else stays unconditional and unchanged:

  • Outbound blocking and SSRF checks still run for every call.
  • Port-based recording is untouched — real outbound requests go through URLCollector, which supplies the port.
  • Named hosts that resolve to private IPs are still recorded.

Trade-off: a genuine outbound request to a literal public IP through a client we don't instrument (no pending port) won't show in outbound telemetry anymore. Blocking and SSRF still run for it, so it's a visibility gap, not a security one. Temporary until outbound is detected at the HTTP-client layer instead of the ambiguous InetAddress sink.

Tests: public IPv4/IPv6 with no port (not recorded), public IP with a pending port (still recorded), and public IP still blocked in lockdown.

@aikido-pr-checks

aikido-pr-checks Bot commented Aug 3, 2026

Copy link
Copy Markdown

Summary by Aikido

Security Issues: 0 Quality Issues: 0 Resolved Issues: 0

⚡ Enhancements

  • Adjusted DNS recording to skip all literal IPs without pending port
  • Replaced IsPrivateIP import with IPValidator and updated comment

More info

Extends #325 from private-IP literals to any literal IPv4/IPv6 address.
A literal IP reaching the getAllByName sink with no pending port is usually
inbound IP parsing (e.g. Spring Security IpAddressMatcher) rather than an
outbound request, and the two can't be told apart here, so it's no longer
recorded as outbound telemetry. Uses IPValidator.isIP instead of IsPrivateIP
so public IP literals are skipped too.

Outbound blocking, SSRF checks and port-based recording stay unconditional,
so a genuine outbound request to a literal IP is still blocked/SSRF-checked,
just not recorded. Temporary fix (see #294) until outbound is detected at
instrumented HTTP clients rather than the ambiguous InetAddress sink.
@Mishenevd
Mishenevd force-pushed the fix/skip-recording-ip-literals-without-port branch from 63dcde1 to e5694ac Compare August 3, 2026 14:00
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hansott
hansott merged commit ab212a0 into main Aug 3, 2026
501 of 504 checks passed
@hansott
hansott deleted the fix/skip-recording-ip-literals-without-port branch August 3, 2026 14:23
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.

2 participants