fix(scan): percent-encode dork queries before search - #327
Conversation
pr summary2 files changed (+95 -5)
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #327 +/- ##
=======================================
Coverage ? 54.74%
=======================================
Files ? 81
Lines ? 6876
Branches ? 0
=======================================
Hits ? 3764
Misses ? 2843
Partials ? 269 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
the google-search client only swaps spaces for '+' and drops the term into the query string verbatim, so a dork carrying a raw '#' or '&' cut the request url short at the fragment or split it into stray query params. the search then ran against a fragment of the intended dork. encode the term up front so the whole dork survives.
e368f7c to
24bf8ee
Compare
vmfunc
left a comment
There was a problem hiding this comment.
checked the actual client, buildUrl in rocketlaunchr/google-search just does Trim then space->'+' and drops the term straight into ?q=, zero encoding. so yeah, a raw '#' landed in the fragment and '&' split the params, exactly as you describe. QueryEscape is the right call here: space still ends up as '+' so the client's own replace is a no-op, and '#'/'&'/'+' round-trip clean on google's side. nice that buildSearchURL in the test actually mirrors buildUrl instead of asserting against itself, the truncation guard is real. in.
the google-search client only swaps spaces for '+' and drops the term
into the query string verbatim, so a dork carrying a raw '#' or '&' cut
the request url short at the fragment or split it into stray query
params. the search then ran against a fragment of the intended dork.
encode the term up front so the whole dork survives.