mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-24 01:12:37 +08:00
Merge 29c078e87c into 138571da95
This commit is contained in:
commit
eaacfc9f83
@ -102,6 +102,24 @@ def comfy_url_and_proc(comfy_tmp_base_dir: Path, request: pytest.FixtureRequest)
|
|||||||
if not (comfy_root / "main.py").is_file():
|
if not (comfy_root / "main.py").is_file():
|
||||||
raise FileNotFoundError(f"main.py not found under {comfy_root}")
|
raise FileNotFoundError(f"main.py not found under {comfy_root}")
|
||||||
|
|
||||||
|
# Sanitize environment variables to prevent injection attacks via env var manipulation.
|
||||||
|
# Strip known-dangerous variables that can redirect code execution or hijack the runtime.
|
||||||
|
_DANGEROUS_ENV_VARS = {
|
||||||
|
"LD_PRELOAD",
|
||||||
|
"LD_LIBRARY_PATH",
|
||||||
|
"DYLD_INSERT_LIBRARIES",
|
||||||
|
"DYLD_LIBRARY_PATH",
|
||||||
|
"PYTHONSTARTUP",
|
||||||
|
"PYTHONINSPECT",
|
||||||
|
"PYTHONPATH",
|
||||||
|
"PYTHONEXECUTABLE",
|
||||||
|
"BROWSER",
|
||||||
|
"CDPATH",
|
||||||
|
"ENV",
|
||||||
|
"BASH_ENV",
|
||||||
|
}
|
||||||
|
safe_env = {k: v for k, v in os.environ.items() if k not in _DANGEROUS_ENV_VARS}
|
||||||
|
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
args=[
|
args=[
|
||||||
sys.executable,
|
sys.executable,
|
||||||
@ -118,7 +136,7 @@ def comfy_url_and_proc(comfy_tmp_base_dir: Path, request: pytest.FixtureRequest)
|
|||||||
stdout=out_log,
|
stdout=out_log,
|
||||||
stderr=err_log,
|
stderr=err_log,
|
||||||
cwd=str(comfy_root),
|
cwd=str(comfy_root),
|
||||||
env={**os.environ},
|
env=safe_env,
|
||||||
)
|
)
|
||||||
|
|
||||||
for _ in range(50):
|
for _ in range(50):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user