Silence known Bandit warnings#130
Merged
Merged
Conversation
There was a problem hiding this comment.
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
subprocessimport andsubprocess.Popen/runcall sites with targeted# noseccodes and rationales. - Annotated broad
except Exception: passblocks with# nosec B110to mark best-effort cleanup/migration behaviors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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 |
| 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 on lines
3616
to
3617
| result = subprocess.run( # nosec B603,B607 - trusted git invocation | ||
| ['git', 'symbolic-ref', 'refs/remotes/origin/HEAD'], |
|
|
||
| # 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 |
|
|
||
| # 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 |
| # 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 on lines
2295
to
2296
| except Exception: # nosec B110 - metadata parsing is best effort | ||
| pass |
Contributor
Author
|
@siddu-k, Resolved the merge conflicts by bringing in latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#noseccomments with brief justification.Closes Issue CI: Bandit step fails on low‑severity findings in app.py #125 @siddu-k