Files
custom-nodes-security-scan/docs/masquerade-nodes-comfyui-bandit.html

406 lines
14 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
Bandit Report
</title>
<style>
html * {
font-family: "Arial", sans-serif;
}
pre {
font-family: "Monaco", monospace;
}
.bordered-box {
border: 1px solid black;
padding-top:.5em;
padding-bottom:.5em;
padding-left:1em;
}
.metrics-box {
font-size: 1.1em;
line-height: 130%;
}
.metrics-title {
font-size: 1.5em;
font-weight: 500;
margin-bottom: .25em;
}
.issue-description {
font-size: 1.3em;
font-weight: 500;
}
.candidate-issues {
margin-left: 2em;
border-left: solid 1px; LightGray;
padding-left: 5%;
margin-top: .2em;
margin-bottom: .2em;
}
.issue-block {
border: 1px solid LightGray;
padding-left: .5em;
padding-top: .5em;
padding-bottom: .5em;
margin-bottom: .5em;
}
.issue-sev-high {
background-color: Pink;
}
.issue-sev-medium {
background-color: NavajoWhite;
}
.issue-sev-low {
background-color: LightCyan;
}
</style>
</head>
<body>
<div id="metrics">
<div class="metrics-box bordered-box">
<div class="metrics-title">
Metrics:<br>
</div>
Total lines of code: <span id="loc">1117</span><br>
Total lines skipped (#nosec): <span id="nosec">0</span>
</div>
</div>
<br>
<div id="results">
<div id="issue-0">
<div class="issue-block issue-sev-low">
<b>blacklist: </b> Consider possible security implications associated with the subprocess module.<br>
<b>Test ID:</b> B404<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/78.html" target="_blank">CWE-78</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>9<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess" target="_blank">https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess</a><br>
<div class="code">
<pre>
5 from torchvision import transforms
6 from torchvision.ops import masks_to_boxes
7 import torchvision.transforms.functional as TF
8 import torch.nn.functional as torchfn
9 import subprocess
10 import sys
11
12 DELIMITER = &#x27;|&#x27;
</pre>
</div>
</div>
</div>
<div id="issue-1">
<div class="issue-block issue-sev-low">
<b>blacklist: </b> Consider possible security implications associated with the subprocess module.<br>
<b>Test ID:</b> B404<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/78.html" target="_blank">CWE-78</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>19<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess" target="_blank">https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_imports.html#b404-import-subprocess</a><br>
<div class="code">
<pre>
15
16 package_list = None
17 def update_package_list():
18 import sys
19 import subprocess
20
21 global package_list
22 package_list = [r.decode().split(&#x27;==&#x27;)[0] for r in subprocess.check_output([sys.executable, &#x27;-m&#x27;, &#x27;pip&#x27;, &#x27;freeze&#x27;]).split()]
</pre>
</div>
</div>
</div>
<div id="issue-2">
<div class="issue-block issue-sev-low">
<b>subprocess_without_shell_equals_true: </b> subprocess call - check for execution of untrusted input.<br>
<b>Test ID:</b> B603<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/78.html" target="_blank">CWE-78</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>22<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html</a><br>
<div class="code">
<pre>
18 import sys
19 import subprocess
20
21 global package_list
22 package_list = [r.decode().split(&#x27;==&#x27;)[0] for r in subprocess.check_output([sys.executable, &#x27;-m&#x27;, &#x27;pip&#x27;, &#x27;freeze&#x27;]).split()]
23
24 def ensure_package(package_name, import_path=None):
25 global package_list
</pre>
</div>
</div>
</div>
<div id="issue-3">
<div class="issue-block issue-sev-low">
<b>subprocess_without_shell_equals_true: </b> subprocess call - check for execution of untrusted input.<br>
<b>Test ID:</b> B603<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/78.html" target="_blank">CWE-78</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>33<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b603_subprocess_without_shell_equals_true.html</a><br>
<div class="code">
<pre>
29 update_package_list()
30
31 if package_name not in package_list:
32 print(&quot;(First Run) Installing missing package %s&quot; % package_name)
33 subprocess.check_call([sys.executable, &#x27;-m&#x27;, &#x27;pip&#x27;, &#x27;-q&#x27;, &#x27;install&#x27;, import_path])
34 update_package_list()
35
36 def tensor2mask(t: torch.Tensor) -&gt; torch.Tensor:
</pre>
</div>
</div>
</div>
<div id="issue-4">
<div class="issue-block issue-sev-medium">
<b>request_without_timeout: </b> Requests call without timeout<br>
<b>Test ID:</b> B113<br>
<b>Severity: </b>MEDIUM<br>
<b>Confidence: </b>LOW<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/400.html" target="_blank">CWE-400</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>209<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b113_request_without_timeout.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b113_request_without_timeout.html</a><br>
<div class="code">
<pre>
205 if not os.path.exists(file_name):
206 print(f&#x27;Downloading and caching file: {cache_name}&#x27;)
207 with open(file_name, &#x27;wb&#x27;) as file:
208 import requests
209 r = requests.get(url, stream=True)
210 r.raise_for_status()
211 for block in r.iter_content(4096):
212 file.write(block)
</pre>
</div>
</div>
</div>
<div id="issue-5">
<div class="issue-block issue-sev-low">
<b>assert_used: </b> Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.<br>
<b>Test ID:</b> B101<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/703.html" target="_blank">CWE-703</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>727<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html</a><br>
<div class="code">
<pre>
723 mask = torch.nn.functional.interpolate(mask.unsqueeze(1), size=(H, W), mode=&#x27;nearest&#x27;)[:,0,:,:]
724 MB, _, _ = mask.shape
725
726 if MB &lt; B:
727 assert(B % MB == 0)
728 mask = mask.repeat(B // MB, 1, 1)
729
730 # masks_to_boxes errors if the tensor is all zeros, so we&#x27;ll add a single pixel and zero it out at the end
</pre>
</div>
</div>
</div>
<div id="issue-6">
<div class="issue-block issue-sev-low">
<b>assert_used: </b> Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.<br>
<b>Test ID:</b> B101<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/703.html" target="_blank">CWE-703</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>868<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html</a><br>
<div class="code">
<pre>
864 MB = mask.shape[0]
865 PB = image_to_paste.shape[0]
866 if mask_mapping_optional is None:
867 if B &lt; PB:
868 assert(PB % B == 0)
869 image_base = image_base.repeat(PB // B, 1, 1, 1)
870 B, H, W, C = image_base.shape
871 if MB &lt; B:
</pre>
</div>
</div>
</div>
<div id="issue-7">
<div class="issue-block issue-sev-low">
<b>assert_used: </b> Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.<br>
<b>Test ID:</b> B101<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/703.html" target="_blank">CWE-703</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>872<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html</a><br>
<div class="code">
<pre>
868 assert(PB % B == 0)
869 image_base = image_base.repeat(PB // B, 1, 1, 1)
870 B, H, W, C = image_base.shape
871 if MB &lt; B:
872 assert(B % MB == 0)
873 mask = mask.repeat(B // MB, 1, 1)
874 elif B &lt; MB:
875 assert(MB % B == 0)
</pre>
</div>
</div>
</div>
<div id="issue-8">
<div class="issue-block issue-sev-low">
<b>assert_used: </b> Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.<br>
<b>Test ID:</b> B101<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/703.html" target="_blank">CWE-703</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>875<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html</a><br>
<div class="code">
<pre>
871 if MB &lt; B:
872 assert(B % MB == 0)
873 mask = mask.repeat(B // MB, 1, 1)
874 elif B &lt; MB:
875 assert(MB % B == 0)
876 image_base = image_base.repeat(MB // B, 1, 1, 1)
877 if PB &lt; B:
878 assert(B % PB == 0)
</pre>
</div>
</div>
</div>
<div id="issue-9">
<div class="issue-block issue-sev-low">
<b>assert_used: </b> Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.<br>
<b>Test ID:</b> B101<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/703.html" target="_blank">CWE-703</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>878<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html</a><br>
<div class="code">
<pre>
874 elif B &lt; MB:
875 assert(MB % B == 0)
876 image_base = image_base.repeat(MB // B, 1, 1, 1)
877 if PB &lt; B:
878 assert(B % PB == 0)
879 image_to_paste = image_to_paste.repeat(B // PB, 1, 1, 1)
880 mask = torch.nn.functional.interpolate(mask.unsqueeze(1), size=(H, W), mode=&#x27;nearest&#x27;)[:,0,:,:]
881 MB, MH, MW = mask.shape
</pre>
</div>
</div>
</div>
<div id="issue-10">
<div class="issue-block issue-sev-low">
<b>assert_used: </b> Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.<br>
<b>Test ID:</b> B101<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/703.html" target="_blank">CWE-703</a><br>
<b>File: </b><a href="/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py" target="_blank">/custom_nodes/masquerade-nodes-comfyui/MaskNodes.py</a><br>
<b>Line number: </b>1298<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b101_assert_used.html</a><br>
<div class="code">
<pre>
1294 return (hsv,)
1295 elif out_space == &quot;RGB&quot;:
1296 return (hsv2rgb(hsv),)
1297 else:
1298 assert out_space == &quot;HSL&quot;
1299 return (hsv2hsl(hsv),)
1300
1301 class MaqueradeIncrementerNode:
</pre>
</div>
</div>
</div>
</div>
</body>
</html>