Skip to content

Commit

Permalink
Merge pull request #1820 from blacklanternsecurity/parent-url-bug
Browse files Browse the repository at this point in the history
Fix parent_url() to remove querystring
  • Loading branch information
liquidsec authored Oct 5, 2024
2 parents 0aad57e + 495a452 commit 2054428
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bbot/core/helpers/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def parent_url(u):
if path.parent == path:
return None
else:
return urlunparse(parsed._replace(path=str(path.parent)))
return urlunparse(parsed._replace(path=str(path.parent), query=""))


def url_parents(u):
Expand Down
2 changes: 2 additions & 0 deletions bbot/test/test_step_1/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_httpserver):
assert helpers.url_depth("http://evilcorp.com/") == 0
assert helpers.url_depth("http://evilcorp.com") == 0

assert helpers.parent_url("http://evilcorp.com/subdir1/subdir2?foo=bar") == "http://evilcorp.com/subdir1"

### MISC ###
assert helpers.is_domain("evilcorp.co.uk")
assert not helpers.is_domain("www.evilcorp.co.uk")
Expand Down

0 comments on commit 2054428

Please sign in to comment.