Skip to content

Trim trailing dot from trusted IMDS hostnames#296

Open
bitterpanda63 wants to merge 1 commit into
mainfrom
fix/trusted-hostname-trailing-dot
Open

Trim trailing dot from trusted IMDS hostnames#296
bitterpanda63 wants to merge 1 commit into
mainfrom
fix/trusted-hostname-trailing-dot

Conversation

@bitterpanda63

@bitterpanda63 bitterpanda63 commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

DNS resolvers sometimes return fully-qualified domain names with a trailing dot (e.g. metadata.google.internal.). The previous include? check in StoredSSRFScanner#attack? did not match this form, so GCP IMDS requests could be incorrectly flagged as stored SSRF.

  • Use chomp(".") to strip a trailing dot before the allowed-host lookup
  • Add test cases for trailing-dot variants

This is the same fix already applied in firewall-go (PR #459). Ported to Python, Ruby, .NET, PHP, and Java.

Test plan

  • bundle exec rake test passes

Summary by Aikido

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

🐛 Bugfixes

  • Stripped trailing dot from hostname before trusted-host lookup

More info

DNS resolvers may return hostnames with a trailing dot (FQDN form),
e.g. `metadata.google.internal.`. The previous `include?` check did not
match these, risking false-positive stored-SSRF blocks for GCP IMDS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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