Repository navigation
fix(leads): complete domain-intel input validation - #113
Merged
Merged
Conversation
POST /api/leads/domain-intel passed the caller's text to RDAP, Cloudflare DoH
and crt.sh almost as typed:
- a non-string domain raised AttributeError (HTTP 500);
- replace("www.", "") removed a "www." anywhere in the name, so awww.example.com
was analyzed as aexample.com;
- the name was not lowercased, but crt.sh results are, so Example.com always
reported zero subdomains;
- a path, port, query, space or "&exclude=..." went straight into the RDAP and
crt.sh request URLs.
Add clean_domain(): take the hostname of a domain or URL, lowercase it, drop a
trailing dot and a leading www. only, convert IDNs to punycode and accept only
a valid hostname. The route returns 400 for anything else.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
Catch ValueError from URL parsing and hostname extraction before domain analysis. Preserve protocol-relative URLs instead of adding a second // prefix. Add direct and route regressions for malformed brackets, NFKC netloc separators, and protocol-relative input. Signed-off-by: Palash Debnath <4178343+debpalash@users.noreply.github.com>
debpalash
marked this pull request as ready for review
October 23, 2026 08:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continuation of #102, preserving Rudy Celekli's original commit ff77c11 and its authorship/sign-off unchanged. This replacement is on a maintainer-owned branch because the connected account cannot push to the contributor's fork.
//prefix.Security-sensitive path: this changes input validation before outbound domain-intelligence calls. It does not change provider destinations or the SSRF guard.
Validation
uv run --frozen pytest -q tests/test_domain_intel_route.py.The original PR is left open for now. No merge or deployment is included in this change.