fix: encode user-controlled input in request query strings (batch 1/#574) - #602
Merged
Merged
Conversation
A-S-Manoj
marked this pull request as ready for review
August 24, 2026 08:33
kaifcodec
approved these changes
Aug 24, 2026
kaifcodec
left a comment
Owner
There was a problem hiding this comment.
@A-S-Manoj I've tested the modules and they work perfectly. MERGING IT!
However, when you open the PR for batch 2, please update the CONTRIBUTING.md guidelines to mention this new approach. This will ensure future contributors follow the same standard for URL encoding.
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.
Related to #574 (batch 1)
Problem
Several scan modules build request URLs by interpolating user-controlled values (
user,username,email,target) directly into an f-string query parameter, without percent-encoding:If the input contains characters such as
&,#,%,+, whitespace, or non-ASCII characters (all valid in usernames/emails), the resulting request can be corrupted — truncated queries, unintended extra parameters, or requests silently hitting the wrong data.Fix
Per the pattern discussed on #574, switched these to httpx's
params=argument (threaded throughgeneric_validate/make_request/status_validate/impersonate_request), which encodes correctly and is cleaner than wrapping every call site inurllib.parse.quote().Changes
This is batch 1 of 15 affected files:
user_scanner/core/hudson.pyuser_scanner/email_scan/crm/axonaut.pyuser_scanner/email_scan/learning/duolingo.pyuser_scanner/user_scan/shopping/vinted.pyuser_scanner/user_scan/community/wikipedia.pyuser_scanner/user_scan/community/hackernews.pyuser_scanner/user_scan/community/lemmy.pyuser_scanner/user_scan/community/archwiki.pyuser_scanner/user_scan/community/fandom.pyuser_scanner/user_scan/community/thefirearmsforum.pyuser_scanner/user_scan/community/defensivecarry.pyuser_scanner/user_scan/social/threads.pyuser_scanner/user_scan/social/pr0gramm.pyuser_scanner/user_scan/social/minds.pytests/test_hudson.py— updated the mock client to accept/recordparams, and added a regression test asserting the target is passed viaparamsrather than baked into the URLRemaining ~24 affected files (including
instagram.py,gitlab.py,mastodon.py, and others acrossdev/,social/,learning/,creator/, etc.) will follow in subsequent batches.Testing
Verified each modified module's actual outgoing request (mocking the underlying transport) to confirm the target is passed correctly via
paramsrather than the raw URL, using inputs likeuser+tag@example.comto prove special characters no longer get mangled. Full suite: 375 passed, 3 skipped (pre-existing, unrelated) against currentmain.ruff check .andmypy user_scannerboth clean.