Skip to content

test(webfetch): cover per-lookup address policy for DNS rebinding - #110

Merged
gabrielvfonseca merged 1 commit into
mainfrom
test/webfetch-resolution-policy
Oct 27, 2026
Merged

gabrielvfonseca merged 1 commit into
mainfrom
test/webfetch-resolution-policy

Conversation

@gabrielvfonseca

Copy link
Copy Markdown
Contributor

Summary

Closes the test gap around DNS rebinding in WebFetch. The guarded resolver already checks every address on every connection. This change moves the address policy into check_resolved_addrs, which can be called without DNS, and tests the cases the defence depends on: public-only answers pass; private, metadata, and empty answers are refused; a mixed public/private answer is refused.

Not covered

Real DNS rebinding against live networks is still not exercised here. The test checks the per-lookup policy, not the resolver's timing.

Verification

  • cargo test -p code-tools passes, including resolved_addresses_are_all_checked_on_every_lookup.
  • cargo clippy -p code-tools --all-targets -- -D warnings passes.

🤖 Generated with Claude Code

Split the address check out of resolve_checked_host so the guarded resolver's
policy can be tested without live DNS. Tests cover public-only, private-only,
metadata, mixed public/private, and empty answers. The resolver runs this check
on every connection, so a name that changes answer is refused on the lookup
that returns the private address.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5a23b88-19fb-4904-8465-d98eb0527dae
Commits

Reviewing files that changed from the base of the PR and between 4177731 and 8c5f379.

Files selected for processing: 1
  • crates/code-tools/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gabrielvfonseca
gabrielvfonseca merged commit eab5d68 into main Oct 27, 2026
17 checks passed
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