mirror of
https://github.com/hanzoui/custom-nodes-security-scan.git
synced 2026-10-30 20:56:54 +00:00
- 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
463 lines
17 KiB
HTML
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 >= 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="bicubic",
|
|
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"only {len(output)} / {len(blocks_to_take)} blocks found"
|
|
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"only {len(output)} / {len(blocks_to_take)} blocks found"
|
|
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) -> Tensor:
|
|
68 if not XFORMERS_AVAILABLE:
|
|
69 assert attn_bias is None, "xFormers is required for nested tensors usage"
|
|
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]) -> List[Tensor]:
|
|
206 """
|
|
207 x_list contains a list of tensors to nest together and run
|
|
208 """
|
|
209 assert isinstance(self.attn, MemEffAttention)
|
|
210
|
|
211 if self.training and self.sample_drop_ratio > 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, "Please install xFormers for nested tensors usage"
|
|
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) -> Tensor:
|
|
71 _, _, H, W = x.shape
|
|
72 patch_H, patch_W = self.patch_size
|
|
73
|
|
74 assert H % patch_H == 0, f"Input image height {H} is not a multiple of patch height {patch_H}"
|
|
75 assert W % patch_W == 0, f"Input image width {W} is not a multiple of patch width: {patch_W}"
|
|
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"Input image height {H} is not a multiple of patch height {patch_H}"
|
|
75 assert W % patch_W == 0, f"Input image width {W} is not a multiple of patch width: {patch_W}"
|
|
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>
|