-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor NRTMv4 fixes #971
Minor NRTMv4 fixes #971
Conversation
mxsasha
commented
Nov 13, 2024
- Fix relative URL compatibility for RIPE
- Update database status for NRTMv4 client success
@@ -340,8 +342,11 @@ | |||
for delta in unf.deltas: | |||
if delta.version < next_version: | |||
continue | |||
url = delta.full_url(self.notification_file_url) | |||
if "nrtm.db.ripe.net" in self.notification_file_url: # pragma: no cover |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
nrtm.db.ripe.net
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 7 days ago
To fix the problem, we need to parse the URL and check the hostname properly instead of using a substring check. This can be done using the urlparse
function from the urllib.parse
module. We will extract the hostname from the URL and then check if it matches the allowed host.
- Parse the URL using
urlparse
. - Extract the hostname from the parsed URL.
- Check if the hostname matches the allowed host "nrtm.db.ripe.net".
-
Copy modified line R6 -
Copy modified lines R289-R290 -
Copy modified lines R348-R349
@@ -5,2 +5,3 @@ | ||
import pydantic | ||
from urllib.parse import urlparse | ||
from joserfc.rfc7515.model import CompactSignature | ||
@@ -287,3 +288,4 @@ | ||
url = unf.snapshot.full_url(self.notification_file_url) | ||
if "nrtm.db.ripe.net" in self.notification_file_url: # pragma: no cover | ||
parsed_url = urlparse(self.notification_file_url) | ||
if parsed_url.hostname == "nrtm.db.ripe.net": # pragma: no cover | ||
url = unf.snapshot.url | ||
@@ -345,3 +347,4 @@ | ||
url = delta.full_url(self.notification_file_url) | ||
if "nrtm.db.ripe.net" in self.notification_file_url: # pragma: no cover | ||
parsed_url = urlparse(self.notification_file_url) | ||
if parsed_url.hostname == "nrtm.db.ripe.net": # pragma: no cover | ||
url = delta.url |