Metrics:
Total lines of code: 1875
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/KepPromptLang/lib/actions/scale_dims.py
Line number: 40
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
36	
37	            if len(arg) != 1:
38	                raise ValueError("ScaleDims scale args must be in the format of <dim>,<scale>(e.g. 4,1.5) but got multiple segments")
39	            extracted_arg = arg[0]
40	            assert isinstance(extracted_arg, PromptSegment)
41	
42	            if "," not in extracted_arg.text:
43	                raise ValueError("ScaleDims scale args must be in the format of <dim>,<scale>(e.g. 4,1.5) but got a segment with no comma: " + extracted_arg.text)
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/KepPromptLang/lib/actions/set_dims.py
Line number: 40
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
36	
37	            if len(arg) != 1:
38	                raise ValueError("SetDims value args must be in the format of <dim>,<value>(e.g. 4,1.5) but got multiple segments")
39	            extracted_arg = arg[0]
40	            assert isinstance(extracted_arg, PromptSegment)
41	
42	            if "," not in extracted_arg.text:
43	                raise ValueError("SetDims value args must be in the format of <dim>,<value>(e.g. 4,1.5) but got a segment with no comma: " + extracted_arg.text)
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/KepPromptLang/lib/clip_model.py
Line number: 31
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
27	    def __init__(self, version="openai/clip-vit-large-patch14", device="cpu", max_length=77,
28	                 freeze=True, layer="last", layer_idx=None, textmodel_json_config=None,
29	                 textmodel_path=None, dtype=None):  # clip-vit-base-patch32
30	        super().__init__()
31	        assert layer in self.LAYERS
32	        self.num_layers = 12
33	        if textmodel_path is not None:
34	            # Our transformer
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/KepPromptLang/lib/clip_model.py
Line number: 62
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
58	        self.logit_scale = torch.nn.Parameter(torch.tensor(4.6055))
59	
60	        self.layer_norm_hidden_state = True
61	        if layer == "hidden":
62	            assert layer_idx is not None
63	            assert abs(layer_idx) <= self.num_layers
64	            self.clip_layer(layer_idx)
65	        self.layer_default = (self.layer, self.layer_idx)
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/KepPromptLang/lib/clip_model.py
Line number: 63
More info: https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html
59	
60	        self.layer_norm_hidden_state = True
61	        if layer == "hidden":
62	            assert layer_idx is not None
63	            assert abs(layer_idx) <= self.num_layers
64	            self.clip_layer(layer_idx)
65	        self.layer_default = (self.layer, self.layer_idx)
66	
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/KepPromptLang/test_files/run_workflow.py
Line number: 20
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b310-urllib-urlopen
16	    data = json.dumps(p).encode('utf-8')
17	    req =  urllib.request.Request("http://{}/prompt".format(server_address), data=data)
18	
19	    try:
20	        response = urllib.request.urlopen(req)
21	        return json.loads(response.read())
22	    except urllib.error.HTTPError as e:
23	        print(f"HTTP Error {e.code}: {e.reason}")
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/KepPromptLang/test_files/run_workflow.py
Line number: 41
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b310-urllib-urlopen
37	
38	def get_image(filename, subfolder, folder_type):
39	    data = {"filename": filename, "subfolder": subfolder, "type": folder_type}
40	    url_values = urllib.parse.urlencode(data)
41	    with urllib.request.urlopen("http://{}/view?{}".format(server_address, url_values)) as response:
42	        return response.read()
43	
44	def get_history(prompt_id):
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/KepPromptLang/test_files/run_workflow.py
Line number: 45
More info: https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b310-urllib-urlopen
41	    with urllib.request.urlopen("http://{}/view?{}".format(server_address, url_values)) as response:
42	        return response.read()
43	
44	def get_history(prompt_id):
45	    with urllib.request.urlopen("http://{}/history/{}".format(server_address, prompt_id)) as response:
46	        return json.loads(response.read())
47	
48	def get_images(ws, prompt):