Files
custom-nodes-security-scan/docs/ComfyUI-DepthAnythingV2-bandit.html
zeekay 6bdea42e64 rebrand: Hanzo AI Inc — full rebrand from ComfyUI/Comfy-Org
- Updated copyright to Hanzo AI, Inc.
- Replaced ComfyUI references with Hanzo Studio
- Updated GitHub org URLs (Comfy-Org → hanzoui)
- Updated domains (comfy.org → hanzo.ai)
- Updated package names and npm scopes
- Updated LICENSE with Hanzo AI copyright header
2026-02-23 10:54:25 -08:00

463 lines
17 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">1196</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>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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py</a><br>
<b>Line number: </b>111<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>
107 num_patches = self.patch_embed.num_patches
108
109 self.cls_token = nn.Parameter(torch.zeros(1, 1, embed_dim))
110 self.pos_embed = nn.Parameter(torch.zeros(1, num_patches + self.num_tokens, embed_dim))
111 assert num_register_tokens &gt;= 0
112 self.register_tokens = (
113 nn.Parameter(torch.zeros(1, num_register_tokens, embed_dim)) if num_register_tokens else None
114 )
</pre>
</div>
</div>
</div>
<div id="issue-1">
<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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py</a><br>
<b>Line number: </b>207<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>
203 mode=&quot;bicubic&quot;,
204 antialias=self.interpolate_antialias
205 )
206
207 assert int(w0) == patch_pos_embed.shape[-2]
208 assert int(h0) == patch_pos_embed.shape[-1]
209 patch_pos_embed = patch_pos_embed.permute(0, 2, 3, 1).view(1, -1, dim)
210 return torch.cat((class_pos_embed.unsqueeze(0), patch_pos_embed), dim=1).to(previous_dtype)
</pre>
</div>
</div>
</div>
<div id="issue-2">
<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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py</a><br>
<b>Line number: </b>208<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>
204 antialias=self.interpolate_antialias
205 )
206
207 assert int(w0) == patch_pos_embed.shape[-2]
208 assert int(h0) == patch_pos_embed.shape[-1]
209 patch_pos_embed = patch_pos_embed.permute(0, 2, 3, 1).view(1, -1, dim)
210 return torch.cat((class_pos_embed.unsqueeze(0), patch_pos_embed), dim=1).to(previous_dtype)
211
</pre>
</div>
</div>
</div>
<div id="issue-3">
<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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py</a><br>
<b>Line number: </b>280<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>
276 for i, blk in enumerate(self.blocks):
277 x = blk(x)
278 if i in blocks_to_take:
279 output.append(x)
280 assert len(output) == len(blocks_to_take), f&quot;only {len(output)} / {len(blocks_to_take)} blocks found&quot;
281 return output
282
283 def _get_intermediate_layers_chunked(self, x, n=1):
</pre>
</div>
</div>
</div>
<div id="issue-4">
<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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2.py</a><br>
<b>Line number: </b>294<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>
290 x = blk(x)
291 if i in blocks_to_take:
292 output.append(x)
293 i += 1
294 assert len(output) == len(blocks_to_take), f&quot;only {len(output)} / {len(blocks_to_take)} blocks found&quot;
295 return output
296
297 def get_intermediate_layers(
</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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/attention.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/attention.py</a><br>
<b>Line number: </b>69<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>
65
66 class MemEffAttention(Attention):
67 def forward(self, x: Tensor, attn_bias=None) -&gt; Tensor:
68 if not XFORMERS_AVAILABLE:
69 assert attn_bias is None, &quot;xFormers is required for nested tensors usage&quot;
70 return super().forward(x)
71
72 B, N, C = x.shape
</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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/block.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/block.py</a><br>
<b>Line number: </b>209<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>
205 def forward_nested(self, x_list: List[Tensor]) -&gt; List[Tensor]:
206 &quot;&quot;&quot;
207 x_list contains a list of tensors to nest together and run
208 &quot;&quot;&quot;
209 assert isinstance(self.attn, MemEffAttention)
210
211 if self.training and self.sample_drop_ratio &gt; 0.0:
212
</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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/block.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/block.py</a><br>
<b>Line number: </b>249<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>
245 def forward(self, x_or_x_list):
246 if isinstance(x_or_x_list, Tensor):
247 return super().forward(x_or_x_list)
248 elif isinstance(x_or_x_list, list):
249 assert XFORMERS_AVAILABLE, &quot;Please install xFormers for nested tensors usage&quot;
250 return self.forward_nested(x_or_x_list)
251 else:
252 raise AssertionError
</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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py</a><br>
<b>Line number: </b>20<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>
16 ops = comfy.ops.manual_cast
17
18 def make_2tuple(x):
19 if isinstance(x, tuple):
20 assert len(x) == 2
21 return x
22
23 assert isinstance(x, int)
</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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py</a><br>
<b>Line number: </b>23<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>
19 if isinstance(x, tuple):
20 assert len(x) == 2
21 return x
22
23 assert isinstance(x, int)
24 return (x, x)
25
26
</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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py</a><br>
<b>Line number: </b>74<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>
70 def forward(self, x: Tensor) -&gt; Tensor:
71 _, _, H, W = x.shape
72 patch_H, patch_W = self.patch_size
73
74 assert H % patch_H == 0, f&quot;Input image height {H} is not a multiple of patch height {patch_H}&quot;
75 assert W % patch_W == 0, f&quot;Input image width {W} is not a multiple of patch width: {patch_W}&quot;
76
77 x = self.proj(x) # B C H W
</pre>
</div>
</div>
</div>
<div id="issue-11">
<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/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/depth_anything_v2/dinov2_layers/patch_embed.py</a><br>
<b>Line number: </b>75<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>
71 _, _, H, W = x.shape
72 patch_H, patch_W = self.patch_size
73
74 assert H % patch_H == 0, f&quot;Input image height {H} is not a multiple of patch height {patch_H}&quot;
75 assert W % patch_W == 0, f&quot;Input image width {W} is not a multiple of patch width: {patch_W}&quot;
76
77 x = self.proj(x) # B C H W
78 H, W = x.size(2), x.size(3)
</pre>
</div>
</div>
</div>
<div id="issue-12">
<div class="issue-block issue-sev-low">
<b>try_except_pass: </b> Try, Except, Pass detected.<br>
<b>Test ID:</b> B110<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/Hanzo Studio-DepthAnythingV2/nodes.py" target="_blank">/custom_nodes/Hanzo Studio-DepthAnythingV2/nodes.py</a><br>
<b>Line number: </b>19<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html" target="_blank">https://bandit.readthedocs.io/en/1.7.9/plugins/b110_try_except_pass.html</a><br>
<div class="code">
<pre>
15 try:
16 from accelerate import init_empty_weights
17 from accelerate.utils import set_module_tensor_to_device
18 is_accelerate_available = True
19 except:
20 pass
21
22 class DownloadAndLoadDepthAnythingV2Model:
23 @classmethod
</pre>
</div>
</div>
</div>
</div>
</body>
</html>