Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: add some Bandit exclusions #6018

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions utils/call_stacks_analysis/log_call_all_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2024, Intel Corporation

import subprocess
import subprocess # nosec B304
import json
import re

Expand Down Expand Up @@ -84,7 +84,16 @@ def file_should_be_ignored(file: str) -> bool:
return False

def extract_all_calls(func: str) -> List[Dict]:
returned_output = subprocess.check_output(['grep', '-Irn', func], cwd=TOP)
# XXX The grep call could be replaced by os.walk() call + for loops over
# all lines of all files + re.search().
# In the meantime:
# B607: Starting a process with a partial executable path - ignored since it
# is normal way of accessing system utilities.
# B603: subprocess call - check for execution of untrusted input - there is
# no way around it. Theoretically, some bad actor could inject faulty grep
# in the head of the PATH which will lead to us parsing whatever they could
# benefit from. So, do not commit the produced code automatically.
returned_output = subprocess.check_output(['grep', '-Irn', func], cwd=TOP) # nosec B607, B603
string = returned_output.decode("utf-8")
calls = []
total = 0
Expand Down
Loading