Skip to content

Silence known Bandit warnings#130

Merged
siddu-k merged 2 commits into
siddu-k:mainfrom
YUVRAJ-SINGH-3178:fix/bandit-ci
May 31, 2026
Merged

Silence known Bandit warnings#130
siddu-k merged 2 commits into
siddu-k:mainfrom
YUVRAJ-SINGH-3178:fix/bandit-ci

Conversation

@YUVRAJ-SINGH-3178

Copy link
Copy Markdown
Contributor
  • Suppresses known low‑severity Bandit findings in app.py (subprocess usage and best‑effort cleanup/migration blocks) using targeted #nosec comments with brief justification.
  • No runtime behavior changes; intended only to stop CI from failing on these known‑safe patterns.
  • Scope: app.py.
    Closes Issue CI: Bandit step fails on low‑severity findings in app.py #125 @siddu-k

Copilot AI review requested due to automatic review settings May 27, 2026 16:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Bandit suppression annotations (# nosec) around subprocess usage and “best effort” exception handling to reduce security-linter noise while documenting intent.

Changes:

  • Annotated subprocess import and subprocess.Popen/run call sites with targeted # nosec codes and rationales.
  • Annotated broad except Exception: pass blocks with # nosec B110 to mark best-effort cleanup/migration behaviors.

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

Comment thread app.py Outdated
try:
# Check if we are in a git repo
subprocess.run(['git', 'rev-parse', '--is-inside-work-tree'], check=True, capture_output=True, shell=False)
subprocess.run(['git', 'rev-parse', '--is-inside-work-tree'], check=True, capture_output=True, shell=False) # nosec B603,B607 - trusted git invocation
Comment thread app.py Outdated
remote_url = target_repo.replace('.git', '')
else:
remote_res = subprocess.run(['git', 'remote', 'get-url', 'origin'], check=True, capture_output=True, text=True, shell=False)
remote_res = subprocess.run(['git', 'remote', 'get-url', 'origin'], check=True, capture_output=True, text=True, shell=False) # nosec B603,B607 - trusted git invocation
Comment thread app.py Outdated
Comment on lines 3616 to 3617
result = subprocess.run( # nosec B603,B607 - trusted git invocation
['git', 'symbolic-ref', 'refs/remotes/origin/HEAD'],
Comment thread app.py Outdated

# 1. Create new local branch for the contribution
checkout_existing = subprocess.run(['git', 'checkout', branch_name], capture_output=True, shell=False)
checkout_existing = subprocess.run(['git', 'checkout', branch_name], capture_output=True, shell=False) # nosec B603,B607 - trusted git invocation
Comment thread app.py Outdated

# 2. Stage only the specific script file
subprocess.run(['git', 'add', full_path], check=True, capture_output=True, shell=False)
subprocess.run(['git', 'add', full_path], check=True, capture_output=True, shell=False) # nosec B603,B607 - trusted git invocation
Comment thread app.py Outdated
# Otherwise, we push to the default 'origin'.
remote_to_push = target_repo if target_repo else 'origin'
subprocess.run(['git', 'push', '-u', remote_to_push, branch_name], check=True, capture_output=True, shell=False)
subprocess.run(['git', 'push', '-u', remote_to_push, branch_name], check=True, capture_output=True, shell=False) # nosec B603,B607 - trusted git invocation
Comment thread app.py Outdated
Comment on lines 2295 to 2296
except Exception: # nosec B110 - metadata parsing is best effort
pass
@YUVRAJ-SINGH-3178

Copy link
Copy Markdown
Contributor Author

@siddu-k, Resolved the merge conflicts by bringing in latest upstream/main and keeping the targeted Bandit suppressions in app.py only. No behavior changes intended, just CI noise reduction.

@siddu-k siddu-k merged commit 1786579 into siddu-k:main May 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants