Skip to content

Commit 9f0dde6

Browse files
committed
fix(lint): remove re-imports in siem_export_url_allowlist validator
Remove local re-imports of 're' and 'urlparse' that shadow the module-level imports (lines 56 and 59), fixing pylint W0404 and W0621 warnings. Signed-off-by: Jonathan Springer <jps@s390x.com>
1 parent 7dc00cc commit 9f0dde6

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

mcpgateway/config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,21 +1749,17 @@ def parse_siem_destinations(cls, value: Any) -> List[Dict[str, Any]]:
17491749
@classmethod
17501750
def validate_siem_url_allowlist(cls, v: List[str]) -> List[str]:
17511751
"""Reject trivially-permissive allowlist entries and warn on empty allowlist."""
1752-
import re as _re
1753-
17541752
validated = []
17551753
for entry in v:
17561754
entry = entry.strip()
17571755
if not entry:
17581756
continue
17591757
# Reject bare protocol prefixes that match everything (e.g., "https://", "http://")
1760-
if _re.match(r"^https?:///?$", entry):
1758+
if re.match(r"^https?:///?$", entry):
17611759
logger.warning("SIEM URL allowlist entry '%s' is a bare protocol prefix that matches all URLs — rejecting", entry)
17621760
continue
17631761
# Reject entries with :// but no hostname (e.g., "https:///")
17641762
if "://" in entry:
1765-
from urllib.parse import urlparse
1766-
17671763
parsed = urlparse(entry)
17681764
if not parsed.hostname:
17691765
logger.warning("SIEM URL allowlist entry '%s' has no hostname — rejecting", entry)

0 commit comments

Comments
 (0)