Skip to content

fix: add nosec annotations for bandit HIGH findings#5452

Open
louiseschmidtgen wants to merge 2 commits intomasterfrom
KU-5612/fix-bandit-findings
Open

fix: add nosec annotations for bandit HIGH findings#5452
louiseschmidtgen wants to merge 2 commits intomasterfrom
KU-5612/fix-bandit-findings

Conversation

@louiseschmidtgen
Copy link
Copy Markdown
Contributor

Summary

Add inline # nosec annotations for intentional security patterns flagged by the new bandit SAST workflow (-lll, HIGH severity only).

These are all documented exceptions — not actual security vulnerabilities:

Finding Annotation Rationale
B501 # nosec B501 verify=False used for internal cluster communication
B602 # nosec B602 subprocess(shell=True) with trusted/controlled input
B324 # nosec B324 MD5 used for content hashing, not security
B701 # nosec B701 Jinja2 autoescape disabled for non-HTML template generation
B202 # nosec B202 tarfile.extractall from trusted upstream release artifacts

Context

Companion to the SAST workflows PR. Once both are merged, the bandit workflow will pass cleanly.

Add inline nosec annotations for intentional security patterns
flagged by bandit -lll (HIGH severity only). These are documented
exceptions, not security vulnerabilities:

- B501: verify=False used for internal cluster communication
- B602: subprocess shell=True with trusted input
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted inline # nosec annotations to suppress intentional Bandit HIGH findings introduced/flagged by the new SAST workflow, without changing runtime behavior.

Changes:

  • Suppress Bandit B602 on a subprocess.Popen(..., shell=True, ...) usage in cluster tests.
  • Suppress Bandit B501 on several requests.post(..., verify=False, ...) calls in wrapper scripts.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/test-cluster.py Adds # nosec B602 on an LXC command execution path using shell=True.
scripts/wrappers/upgrade.py Adds # nosec B501 for an internal HTTPS request with verify=False.
scripts/wrappers/join.py Adds # nosec B501 on certificate-signing requests using verify=False.
scripts/wrappers/distributed_op.py Adds # nosec B501 on distributed HTTPS operations using verify=False.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test-cluster.py Outdated
Comment thread scripts/wrappers/upgrade.py Outdated
Comment thread scripts/wrappers/upgrade.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants