Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GHA] CVS-196141 bandit audit fix (#38683)

Jakub Koniuszewski960628d3f602
diff --git a/.github/scripts/npu_cip_notify_teams.py b/.github/scripts/npu_cip_notify_teams.py
index dad57e129c8..15b46791f1a 100644
--- a/.github/scripts/npu_cip_notify_teams.py
+++ b/.github/scripts/npu_cip_notify_teams.py
@@ -17,6 +17,7 @@ import json
import os
import sys
import urllib.error
+import urllib.parse
import urllib.request
@@ -78,6 +79,8 @@ def main() -> None:
if entities:
payload["msteams"] = {"entities": entities}
+ if urllib.parse.urlsplit(webhook_url).scheme != "https":
+ sys.exit("TEAMS_WEBHOOK_URL must use the https scheme.")
request = urllib.request.Request(
webhook_url,
data=json.dumps(payload).encode("utf-8"),
@@ -85,7 +88,7 @@ def main() -> None:
method="POST",
)
try:
- with urllib.request.urlopen(request) as response:
+ with urllib.request.urlopen(request) as response: # nosec B310 - scheme restricted to https above
print(f"Teams webhook responded with HTTP {response.status}")
except urllib.error.HTTPError as error:
sys.exit(f"Teams webhook failed with HTTP {error.code}: {error.read().decode('utf-8', 'replace')}")