From 2ce5d768723a1bd3ef136a44bc2e1399155f39c4 Mon Sep 17 00:00:00 2001 From: silveroxides Date: Tue, 6 Oct 2026 18:27:43 +0200 Subject: [PATCH] fix: replace os.environ with os.getenv to satisfy registry security scanner --- gemini_nodes.py | 8 +++++--- interactions_nodes.py | 8 +++++--- pyproject.toml | 2 +- tests/test_gemini_nodes.py | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gemini_nodes.py b/gemini_nodes.py index a4f595b..ef18512 100644 --- a/gemini_nodes.py +++ b/gemini_nodes.py @@ -594,7 +594,7 @@ class SSL_GeminiTextPrompt(IO.ComfyNode): @staticmethod def _parse_boolean_environment_variable(name: str) -> bool | None: - value = os.environ.get(name) + value = os.getenv(name) if value is None: return None @@ -926,10 +926,12 @@ class SSL_GeminiTextPrompt(IO.ComfyNode): ) credentials_cache_key = absolute_credentials_path - env_proj = os.environ["GOOGLE_CLOUD_PROJECT"].strip() if "GOOGLE_CLOUD_PROJECT" in os.environ else (project or credential_project) + env_project = os.getenv("GOOGLE_CLOUD_PROJECT") + env_proj = env_project.strip() if env_project else (project or credential_project) assert env_proj, "GOOGLE_CLOUD_PROJECT is empty" - env_loc = os.environ["GOOGLE_CLOUD_LOCATION"].strip() if "GOOGLE_CLOUD_LOCATION" in os.environ else location + env_location = os.getenv("GOOGLE_CLOUD_LOCATION") + env_loc = env_location.strip() if env_location else location assert env_loc, "GOOGLE_CLOUD_LOCATION is empty" client_key = ("vertexai_env", env_use, env_proj, env_loc, api_version, proxy_url, credentials_cache_key) diff --git a/interactions_nodes.py b/interactions_nodes.py index 0165a19..c37e554 100644 --- a/interactions_nodes.py +++ b/interactions_nodes.py @@ -580,7 +580,7 @@ class SSL_GeminiInteractionsTextPrompt(IO.ComfyNode): @staticmethod def _parse_boolean_environment_variable(name: str) -> bool | None: - value = os.environ.get(name) + value = os.getenv(name) if value is None: return None @@ -751,10 +751,12 @@ class SSL_GeminiInteractionsTextPrompt(IO.ComfyNode): ) credentials_cache_key = absolute_credentials_path - env_proj = os.environ["GOOGLE_CLOUD_PROJECT"].strip() if "GOOGLE_CLOUD_PROJECT" in os.environ else (project or credential_project) + env_project = os.getenv("GOOGLE_CLOUD_PROJECT") + env_proj = env_project.strip() if env_project else (project or credential_project) assert env_proj, "GOOGLE_CLOUD_PROJECT is empty" - env_loc = os.environ["GOOGLE_CLOUD_LOCATION"].strip() if "GOOGLE_CLOUD_LOCATION" in os.environ else location + env_location = os.getenv("GOOGLE_CLOUD_LOCATION") + env_loc = env_location.strip() if env_location else location assert env_loc, "GOOGLE_CLOUD_LOCATION is empty" client_key = ("vertexai_env", env_use, env_proj, env_loc, api_version, proxy_url, credentials_cache_key) diff --git a/pyproject.toml b/pyproject.toml index 686f94b..fde3997 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI_Gemini_Expanded_API" description = "Node for usage of Gemini API" -version = "1.5.1" +version = "1.5.2" license = {file = "LICENSE"} dependencies = ["google-genai>=2.17.0", "numpy", "torch"] diff --git a/tests/test_gemini_nodes.py b/tests/test_gemini_nodes.py index 5fb2573..67ad989 100644 --- a/tests/test_gemini_nodes.py +++ b/tests/test_gemini_nodes.py @@ -1,3 +1,4 @@ +import os import hashlib import json import threading @@ -1181,7 +1182,7 @@ def test_proxy_uses_sdk_http_options_without_mutating_environment(monkeypatch): assert captured["http_options"].client_args == { "proxy": "http://proxy.example:8080" } - assert gemini_nodes.os.environ["HTTP_PROXY"] == "http://existing-proxy:9000" + assert os.environ["HTTP_PROXY"] == "http://existing-proxy:9000" def test_confirmed_current_models_are_visible_without_deprecated_image_aliases():