Files
custom-nodes-security-scan/docs/comfyui-Image-reward-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

238 lines
7.6 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">2324</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> Standard pseudo-random generators are not suitable for security/cryptographic purposes.<br>
<b>Test ID:</b> B311<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/330.html" target="_blank">CWE-330</a><br>
<b>File: </b><a href="/custom_nodes/hanzo-studio-Image-reward/ImageReward/ReFL.py" target="_blank">/custom_nodes/hanzo-studio-Image-reward/ImageReward/ReFL.py</a><br>
<b>Line number: </b>566<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random" target="_blank">https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random</a><br>
<div class="code">
<pre>
562 if isinstance(caption, str):
563 captions.append(caption)
564 elif isinstance(caption, (list, np.ndarray)):
565 # take a random caption if there are multiple
566 captions.append(random.choice(caption) if is_train else caption[0])
567 else:
568 raise ValueError(
569 f&quot;Caption column `{caption_column}` should contain either strings or lists of strings.&quot;
</pre>
</div>
</div>
</div>
<div id="issue-1">
<div class="issue-block issue-sev-low">
<b>blacklist: </b> Standard pseudo-random generators are not suitable for security/cryptographic purposes.<br>
<b>Test ID:</b> B311<br>
<b>Severity: </b>LOW<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/330.html" target="_blank">CWE-330</a><br>
<b>File: </b><a href="/custom_nodes/hanzo-studio-Image-reward/ImageReward/ReFL.py" target="_blank">/custom_nodes/hanzo-studio-Image-reward/ImageReward/ReFL.py</a><br>
<b>Line number: </b>717<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random" target="_blank">https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b311-random</a><br>
<div class="code">
<pre>
713
714 self.noise_scheduler.set_timesteps(40, device=self.accelerator.device)
715 timesteps = self.noise_scheduler.timesteps
716
717 mid_timestep = random.randint(30, 39)
718
719 for i, t in enumerate(timesteps[:mid_timestep]):
720 with torch.no_grad():
</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-Image-reward/ImageReward/models/BLIP/blip.py" target="_blank">/custom_nodes/hanzo-studio-Image-reward/ImageReward/models/BLIP/blip.py</a><br>
<b>Line number: </b>27<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>
23
24
25 def create_vit(vit, image_size, use_grad_checkpointing=False, ckpt_layer=0, drop_path_rate=0):
26
27 assert vit in [&#x27;base&#x27;, &#x27;large&#x27;], &quot;vit parameter must be base or large&quot;
28 if vit==&#x27;base&#x27;:
29 vision_width = 768
30 visual_encoder = VisionTransformer(img_size=image_size, patch_size=16, embed_dim=vision_width, depth=12,
</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-Image-reward/ImageReward/models/BLIP/med.py" target="_blank">/custom_nodes/hanzo-studio-Image-reward/ImageReward/models/BLIP/med.py</a><br>
<b>Line number: </b>351<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>
347 outputs = self_attention_outputs[1:-1]
348 present_key_value = self_attention_outputs[-1]
349
350 if mode==&#x27;multimodal&#x27;:
351 assert encoder_hidden_states is not None, &quot;encoder_hidden_states must be given for cross-attention layers&quot;
352
353 cross_attention_outputs = self.crossattention(
354 attention_output,
</pre>
</div>
</div>
</div>
<div id="issue-4">
<div class="issue-block issue-sev-medium">
<b>blacklist: </b> Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.<br>
<b>Test ID:</b> B310<br>
<b>Severity: </b>MEDIUM<br>
<b>Confidence: </b>HIGH<br>
<b>CWE: </b><a href="https://cwe.mitre.org/data/definitions/22.html" target="_blank">CWE-22</a><br>
<b>File: </b><a href="/custom_nodes/hanzo-studio-Image-reward/ImageReward/utils.py" target="_blank">/custom_nodes/hanzo-studio-Image-reward/ImageReward/utils.py</a><br>
<b>Line number: </b>118<br>
<b>More info: </b><a href="https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b310-urllib-urlopen" target="_blank">https://bandit.readthedocs.io/en/1.7.9/blacklists/blacklist_calls.html#b310-urllib-urlopen</a><br>
<div class="code">
<pre>
114
115 if os.path.isfile(download_target):
116 return download_target
117
118 with urllib.request.urlopen(url) as source, open(download_target, &quot;wb&quot;) as output:
119 with tqdm(total=int(source.info().get(&quot;Content-Length&quot;)), ncols=80, unit=&#x27;iB&#x27;, unit_scale=True, unit_divisor=1024) as loop:
120 while True:
121 buffer = source.read(8192)
</pre>
</div>
</div>
</div>
</div>
</body>
</html>