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

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/BizyAir/kolors.py
Line number: 46
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
42	    def encode(self, prompt, negative_prompt, num_images_per_prompt):
43	        API_KEY = get_api_key()
44	        split_pos_text = prompt.split("|")
45	        num_prompts = len(split_pos_text)
46	        assert (
47	            num_prompts * num_images_per_prompt <= 4
48	        ), f"The num_prompts*num_images_per_prompt should be less than or equal 4, got {num_prompts}x{num_images_per_prompt}={num_prompts*num_images_per_prompt}, try to reduce the '|' or num_images_per_prompt"
49	
50	        payload = {
51	            "positive_prompt": prompt,
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/BizyAir/kolors.py
Line number: 226
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
222	            "inputs": None,
223	            "is_compress": True,
224	        }
225	        if latent is not None:
226	            assert (
227	                latent["samples"].shape[0] == kolors_embeds["prompt_embeds"].shape[0]
228	            ), f"The batch size of latent samples should be the same as the prompt_embeds, got {latent['samples'].shape[0]} and {kolors_embeds['prompt_embeds'].shape[0]}"
229	
230	        # convert the tensors to numpy array
231	        np_kolors_embeds = copy.deepcopy(kolors_embeds)
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/BizyAir/supernode.py
Line number: 34
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
30	    def super_resolution(self, image, scale="2x"):
31	        API_KEY = get_api_key()
32	        device = image.device
33	        _, w, h, c = image.shape
34	        assert (
35	            w <= 512 and h <= 512
36	        ), f"width and height must be less than 512, but got {w} and {h}"
37	
38	        # support RGB mode only now
39	        image = image[:, :, :, :3]
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/BizyAir/supernode.py
Line number: 80
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
76	    def remove_background(self, image):
77	        API_KEY = get_api_key()
78	        device = image.device
79	        _, w, h, _ = image.shape
80	        assert (
81	            w <= 1024 and h <= 1024
82	        ), f"width and height must be less than 1024, but got {w} and {h}"
83	
84	        payload = {
85	            "is_compress": True,
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/BizyAir/supernode.py
Line number: 142
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
138	    CATEGORY = "☁️BizyAir"
139	
140	    def generate_image(self, prompt, seed, width, height, cfg, batch_size):
141	        API_KEY = get_api_key()
142	        assert (
143	            width <= 1024 and height <= 1024
144	        ), f"width and height must be less than 1024, but got {width} and {height}"
145	
146	        payload = {
147	            "batch_size": batch_size,
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: /custom_nodes/BizyAir/utils.py
Line number: 4
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b403-import-pickle
1	import base64
2	import json
3	import os
4	import pickle
5	import urllib.request
6	import urllib.parse
7	import zlib
8	
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: /custom_nodes/BizyAir/utils.py
Line number: 27
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b310-urllib-urlopen
23	    """
24	    try:
25	        data = json.dumps(payload).encode("utf-8")
26	        req = urllib.request.Request(api_url, data=data, headers=headers, method="POST")
27	        with urllib.request.urlopen(req) as response:
28	            response_data = response.read().decode("utf-8")
29	        return response_data
30	    except urllib.error.URLError as e:
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: /custom_nodes/BizyAir/utils.py
Line number: 94
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b301-pickle
90	        print(
91	            f"decode_and_deserialize: size of bytes is {format_bytes(len(tensor_bytes))}"
92	        )
93	
94	    deserialized_object = pickle.loads(tensor_bytes)
95	    return deserialized_object
96	
97	
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/BizyAir/utils.py
Line number: 114
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
110	        return f"{num_bytes / (1024 * 1024):.2f} MB"
111	
112	
113	def validate_api_key(key: str):
114	    assert isinstance(key, str), f"API_KEY must be a string, got {type(key)}"
115	    assert key.startswith(
116	        "sk"
117	    ), f"invalid key, please refer to https://cloud.siliconflow.cn to get your API_KEY, got {key}"
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/BizyAir/utils.py
Line number: 115
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
111	
112	
113	def validate_api_key(key: str):
114	    assert isinstance(key, str), f"API_KEY must be a string, got {type(key)}"
115	    assert key.startswith(
116	        "sk"
117	    ), f"invalid key, please refer to https://cloud.siliconflow.cn to get your API_KEY, got {key}"
118	
119	
120	def get_api_key():