diff --git a/bbot/modules/retirejs.py b/bbot/modules/retirejs.py index e7c3da3a9f..22b60ec73b 100644 --- a/bbot/modules/retirejs.py +++ b/bbot/modules/retirejs.py @@ -188,7 +188,7 @@ async def handle_event(self, event): "severity": severity, "confidence": "HIGH", "component": component, - "url": event.parent.data["url"], + "url": event.parent.parsed_url.geturl(), } await self.emit_event( data, diff --git a/bbot/test/test_step_2/module_tests/test_module_retirejs.py b/bbot/test/test_step_2/module_tests/test_module_retirejs.py index 0cf09a8eae..b9ce1ba3c1 100644 --- a/bbot/test/test_step_2/module_tests/test_module_retirejs.py +++ b/bbot/test/test_step_2/module_tests/test_module_retirejs.py @@ -132,6 +132,8 @@ def check(self, module_test, events): for finding in retirejs_findings: assert "description" in finding.data, "Finding should have description" assert "url" in finding.data, "Finding should have url" + # url field should point to the page that loaded the JS, not the JS file itself + assert finding.data["url"] == "http://127.0.0.1:8888/", "url should be the parent page URL" assert finding.parent.type == "URL_UNVERIFIED", "Parent should be URL_UNVERIFIED"