Metrics:
Total lines of code: 5618
Total lines skipped (#nosec): 0

try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/mapping.py
Line number: 27
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html
23	from .nodes.deforum_legacy_nodes import *
24	from .nodes.deforum_logic_nodes import *
25	try:
26	    from .nodes.deforum_noise_nodes import AddCustomNoiseNode
27	except:
28	    pass
29	try:
30	    from .nodes.deforum_advnoise_node import AddAdvancedNoiseNode
31	except:
try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/mapping.py
Line number: 31
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html
27	except:
28	    pass
29	try:
30	    from .nodes.deforum_advnoise_node import AddAdvancedNoiseNode
31	except:
32	    pass
33	from .nodes.deforum_prompt_nodes import *
34	from .nodes.redirect_console_node import DeforumRedirectConsole
35	from .nodes.deforum_sampler_nodes import *
assert_used: Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Test ID: B101
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/modules/deforum_comfy_sampler.py
Line number: 123
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
119	                latent = latent
120	    else:
121	        latent = torch.from_numpy(np.array(init_image).astype(np.float32) / 255.0).unsqueeze(0)
122	        latent = encode_latent(vae, latent, seed, subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w)
123	    assert isinstance(latent, dict), \
124	        "Our Latents have to be in a dict format with the latent being the 'samples' value"
125	
126	    cond = []
127	
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/modules/deforum_comfyui_helpers.py
Line number: 157
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
153	    """
154	    if mode == 'fixed':
155	        return [start_seed for _ in range(max_frames)]
156	    elif mode == 'random':
157	        return [random.randint(0, 2**32 - 1) for _ in range(max_frames)]
158	    elif mode == 'ladder':
159	        # Generate a ladder sequence where the sequence is repeated after reaching the max_frames
160	        return [(start_seed + i // 2 * step if i % 2 == 0 else start_seed + (i // 2 + 1) * step) % (2**32) for i in range(max_frames)]
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/modules/interp.py
Line number: 317
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
313	        magnitude = np.sqrt((x2 - x) ** 2 + (y2 - y) ** 2)
314	
315	        # Only draw the line if it falls within the magnitude range
316	        if min_magnitude <= magnitude <= max_magnitude:
317	            if i % random.randint(100, 200) == 0:
318	                b = int(bgr[y, x, 0])
319	                g = int(bgr[y, x, 1])
320	                r = int(bgr[y, x, 2])
assert_used: Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Test ID: B101
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/modules/standalone_cadence.py
Line number: 73
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
69	                    # print(
70	                    #     f"[deforum] Creating in-between {'' if cadence_flow is None else anim_args.optical_flow_cadence + ' optical flow '}cadence frame: {tween_frame_idx}; tween:{tween:0.2f};")
71	    
72	                if depth_model is not None:
73	                    assert (self.turbo_next_image is not None)
74	                    self.depth = depth_model.predict(self.turbo_next_image, anim_args.midas_weight, root.half_precision) * depth_strength
75	    
76	                if advance_prev:
blacklist: Use of possibly insecure function - consider using safer ast.literal_eval.
Test ID: B307
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_audiosync_nodes.py
Line number: 312
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b307-eval
308	            "or": lambda a, b: a or b,
309	            "not": lambda a: not a,
310	        }
311	        try:
312	            return eval(expr, {"__builtins__": {}}, allowed_locals)
313	        except NameError as e:
314	            raise ValueError(f"Invalid expression: {e}")
315	        except Exception as e:
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_cond_nodes.py
Line number: 158
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
154	        # Copy the original vocabulary for restoration if needed
155	        original_vocab = tokenizer.vocab.copy()
156	
157	        # Seed the random number generator for reproducibility
158	        seeded_random = random.Random(seed)
159	
160	        # Create a list of (key, value) pairs, shuffle it, then convert it back to a dictionary
161	        items = list(original_vocab.items())
try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_interpolation_nodes.py
Line number: 251
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html
247	            self.vram_state = "high"
248	            if "depth_model" in gs.deforum_models:
249	                try:
250	                    gs.deforum_models["depth_model"].to("cpu")
251	                except:
252	                    pass
253	                del gs.deforum_models["depth_model"]
254	
255	            deforum_depth_algo = anim_args.depth_algorithm
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_schedule_visualizer.py
Line number: 198
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
194	    operators = ['+', '-', '*', '/']
195	    globals = ['t', 'max_f', 's']
196	    parts = []
197	
198	    for _ in range(random.randint(1, max_parts)):
199	        func = random.choice(funcs)
200	        operator = random.choice(operators) if parts else ''  # No leading operator for the first part
201	        global_var = random.choice(globals)
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_schedule_visualizer.py
Line number: 199
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
195	    globals = ['t', 'max_f', 's']
196	    parts = []
197	
198	    for _ in range(random.randint(1, max_parts)):
199	        func = random.choice(funcs)
200	        operator = random.choice(operators) if parts else ''  # No leading operator for the first part
201	        global_var = random.choice(globals)
202	        if global_var == 'max_f':
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_schedule_visualizer.py
Line number: 200
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
196	    parts = []
197	
198	    for _ in range(random.randint(1, max_parts)):
199	        func = random.choice(funcs)
200	        operator = random.choice(operators) if parts else ''  # No leading operator for the first part
201	        global_var = random.choice(globals)
202	        if global_var == 'max_f':
203	            global_value = str(max_frames)
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_schedule_visualizer.py
Line number: 201
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random
197	
198	    for _ in range(random.randint(1, max_parts)):
199	        func = random.choice(funcs)
200	        operator = random.choice(operators) if parts else ''  # No leading operator for the first part
201	        global_var = random.choice(globals)
202	        if global_var == 'max_f':
203	            global_value = str(max_frames)
204	        else:
try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_video_nodes.py
Line number: 109
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html
105	        # Initialize or reset video capture
106	        if self.cap is None or self.cap.get(cv2.CAP_PROP_POS_FRAMES) >= self.cap.get(cv2.CAP_PROP_FRAME_COUNT) or self.video_path != video_path or reset:
107	            try:
108	                self.cap.release()
109	            except:
110	                pass
111	            self.cap = cv2.VideoCapture(video_path)
112	            self.current_frame = -1
113	            self.video_path = video_path
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_video_nodes.py
Line number: 159
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b324_hashlib.html
155	            return "Invalid video file: {}".format(video)
156	        return True
157	
158	temp_dir = tempfile.mkdtemp()
159	hash_object = hashlib.md5(temp_dir.encode())
160	hex_dig = hash_object.hexdigest()
161	endpoint = f"/tmp/{hex_dig}/{{filename}}"
162	
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_video_nodes.py
Line number: 161
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b108_hardcoded_tmp_directory.html
157	
158	temp_dir = tempfile.mkdtemp()
159	hash_object = hashlib.md5(temp_dir.encode())
160	hex_dig = hash_object.hexdigest()
161	endpoint = f"/tmp/{hex_dig}/{{filename}}"
162	
163	
164	@server.PromptServer.instance.routes.get(endpoint)
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_video_nodes.py
Line number: 334
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b108_hardcoded_tmp_directory.html
330	            self.audio_path = self.encode_audio_base64(audio, len(self.images), fps, 0)
331	
332	            ui_ret = {"counter":(len(self.images),),
333	                      "should_dump":(clear_cache,),
334	                      "frames":([f"/tmp/{self.hex_dig}/{os.path.basename(frame_path)}" for frame_path in self.images] if restore else [f"/tmp/{self.hex_dig}/{os.path.basename(frame_path)}" for frame_path in new_images]),
335	                      "fps":(fps,),
336	                      "audio":(f"/tmp/{self.hex_dig}/{self.audio_path}",)}
337	            if waveform_image is not None:
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_video_nodes.py
Line number: 334
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b108_hardcoded_tmp_directory.html
330	            self.audio_path = self.encode_audio_base64(audio, len(self.images), fps, 0)
331	
332	            ui_ret = {"counter":(len(self.images),),
333	                      "should_dump":(clear_cache,),
334	                      "frames":([f"/tmp/{self.hex_dig}/{os.path.basename(frame_path)}" for frame_path in self.images] if restore else [f"/tmp/{self.hex_dig}/{os.path.basename(frame_path)}" for frame_path in new_images]),
335	                      "fps":(fps,),
336	                      "audio":(f"/tmp/{self.hex_dig}/{self.audio_path}",)}
337	            if waveform_image is not None:
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/deforum_video_nodes.py
Line number: 336
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b108_hardcoded_tmp_directory.html
332	            ui_ret = {"counter":(len(self.images),),
333	                      "should_dump":(clear_cache,),
334	                      "frames":([f"/tmp/{self.hex_dig}/{os.path.basename(frame_path)}" for frame_path in self.images] if restore else [f"/tmp/{self.hex_dig}/{os.path.basename(frame_path)}" for frame_path in new_images]),
335	                      "fps":(fps,),
336	                      "audio":(f"/tmp/{self.hex_dig}/{self.audio_path}",)}
337	            if waveform_image is not None:
338	                ui_ret["waveform"] = (tensor_to_webp_base64(waveform_image),)
339	        else:
try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: /custom_nodes/deforum-comfy-nodes/deforum_nodes/nodes/redirect_console_node.py
Line number: 58
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html
54	                    server_instance = server.PromptServer.instance
55	                    sys.stdout = StreamToWebSocket(sys.stdout, server_instance, 'stdout')
56	                    sys.stderr = StreamToWebSocket(sys.stderr, server_instance, 'stderr')
57	                    console_redirected = True
58	                except:
59	                    pass
60	            else:
61	                sys.stdout = stdout_backup
62	                sys.stderr = stderr_backup
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 4
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess
1	import os
2	import shutil
3	import sys
4	import subprocess
5	import threading
6	import locale
7	import traceback
8	import re
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 10
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess
6	import locale
7	import traceback
8	import re
9	import os
10	import subprocess
11	import sys
12	import platform
13	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 37
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html
33	            
34	
35	def process_wrap(cmd_str, cwd=None, handler=None):
36	    print(f"[Deforum] EXECUTE: {cmd_str} in '{cwd}'")
37	    process = subprocess.Popen(cmd_str, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1)
38	
39	    if handler is None:
40	        handler = handle_stream
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 63
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html
59	    global pip_list
60	
61	    if pip_list is None:
62	        try:
63	            result = subprocess.check_output([sys.executable, '-m', 'pip', 'list'], universal_newlines=True)
64	            pip_list = set([line.split()[0].lower() for line in result.split('\n') if line.strip()])
65	        except subprocess.CalledProcessError as e:
66	            print(f"[ComfyUI-Manager] Failed to retrieve the information of installed pip packages.")
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 125
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b602_subprocess_popen_with_shell_equals_true.html
121	    """
122	    Runs a git command in the specified working directory and handles basic errors.
123	    """
124	    try:
125	        subprocess.run(command, shell=True, check=True, cwd=working_dir)
126	        print(f"Successfully executed: {command} in {working_dir}")
127	    except subprocess.CalledProcessError as e:
128	        print(f"Error executing {command} in {working_dir}: {e}")
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 170
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess
166	        repo_dir = os.path.join(custom_nodes_path, repo_name)
167	        clone_or_pull_repo(repo_url, repo_dir)
168	
169	
170	import subprocess
171	
172	
173	def install_packages():
start_process_with_partial_path: Starting a process with a partial executable path
Test ID: B607
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 178
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b607_start_process_with_partial_path.html
174	    # Install packages from requirements.txt
175	    # subprocess.run(["pip", "install", "-r", "requirements.txt"], check=True)
176	
177	    # Force reinstall the deforum-studio package from Git
178	    subprocess.run(["pip", "install", "--force-reinstall", "git+https://github.com/XmYx/deforum-studio.git"],
179	                   check=True)
180	
181	
182	def get_cuda_version():
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 178
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html
174	    # Install packages from requirements.txt
175	    # subprocess.run(["pip", "install", "-r", "requirements.txt"], check=True)
176	
177	    # Force reinstall the deforum-studio package from Git
178	    subprocess.run(["pip", "install", "--force-reinstall", "git+https://github.com/XmYx/deforum-studio.git"],
179	                   check=True)
180	
181	
182	def get_cuda_version():
start_process_with_partial_path: Starting a process with a partial executable path
Test ID: B607
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 184
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b607_start_process_with_partial_path.html
180	
181	
182	def get_cuda_version():
183	    try:
184	        cuda_version = subprocess.check_output(["nvcc", "--version"]).decode("utf-8")
185	        for line in cuda_version.split('\n'):
186	            if "release" in line:
187	                return line.split('release')[1].split(',')[0].strip().replace('.', '')
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 184
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html
180	
181	
182	def get_cuda_version():
183	    try:
184	        cuda_version = subprocess.check_output(["nvcc", "--version"]).decode("utf-8")
185	        for line in cuda_version.split('\n'):
186	            if "release" in line:
187	                return line.split('release')[1].split(',')[0].strip().replace('.', '')
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: /custom_nodes/deforum-comfy-nodes/install.py
Line number: 217
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html
213	    os_name = platform.system()
214	    wheel_name = construct_wheel_name(cuda_version, python_version, os_name)
215	    url = f"https://github.com/chengzeyi/stable-fast/releases/download/v1.0.4/{wheel_name}"
216	    print(f"Attempting to install: {wheel_name}")
217	    subprocess.run([sys.executable, "-m", "pip", "install", url])
218	
219	
220