-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add python bandit checks. #316
Merged
zhiltsov-max
merged 25 commits into
openvinotoolkit:develop
from
dvkruchinin:dkru/add-linters-check
Jul 5, 2021
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
f9de057
add linters
dvkruchinin efe68bf
Updated linters check
dvkruchinin 5b0af21
Fix linters errors
dvkruchinin 8232c9a
Fix remark checks
dvkruchinin 27ff2ac
Remark linter fix errors
dvkruchinin b1c4abd
Update remark checks
dvkruchinin 53d46c1
Simple update
dvkruchinin 5fd0c38
Merge branch 'develop' of https://github.com/openvinotoolkit/datumaro…
dvkruchinin 1e1c408
Apply comments
dvkruchinin 4fe6b78
Exclude "docs", "ci" folders from setup.py
dvkruchinin a92c4cb
Linters output to console
dvkruchinin 8153455
Remark report to console
dvkruchinin c6fac80
added --frail to remark-cli for exit with 1 on warnings
dvkruchinin 1fcc16d
Remove json_to_html.py
dvkruchinin 3185f09
check removed "pip install --user -U pip wheel setuptools"
dvkruchinin d4990b3
Merge branch 'develop' of https://github.com/openvinotoolkit/datumaro…
dvkruchinin 0c6e016
Removed pylint checking. Due to it in another PR
dvkruchinin 2ae2805
Revert setup.py for develop
dvkruchinin 682cb20
Reqork pip install.
dvkruchinin 163b507
disable some bandit warnings
930c193
Merge branch 'develop' of https://github.com/openvinotoolkit/datumaro…
dvkruchinin da22177
Merge remote-tracking branch 'origin/dkru/add-linters-check' into dkr…
dvkruchinin 37b98c3
Update datumaro/components/operations.py
7d4abc6
Merge branch 'develop' into dkru/add-linters-check
2b0f147
Update datumaro/util/tf_util.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Linter | ||
on: pull_request | ||
jobs: | ||
Bandit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Run checks | ||
run: | | ||
pip install --user -r <(grep "^bandit" ./requirements.txt) | ||
echo "Bandit version: "`bandit --version | head -1` | ||
bandit -r ./ |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
import os | ||
import os.path as osp | ||
import pickle | ||
import pickle # nosec - disable B403:import_pickle check | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an RCE hole, and it must be fixed. |
||
|
||
import numpy as np | ||
from datumaro.components.converter import Converter | ||
|
@@ -52,7 +52,7 @@ def _load_categories(self, path): | |
# 'dog', 'frog', 'horse', 'ship', 'truck'] | ||
# num_vis: 3072 | ||
with open(path, 'rb') as labels_file: | ||
data = pickle.load(labels_file) | ||
data = pickle.load(labels_file) # nosec - disable B301:pickle check | ||
for label in data['label_names']: | ||
label_cat.add(label) | ||
else: | ||
|
@@ -69,7 +69,7 @@ def _load_items(self, path): | |
# 'filenames': list | ||
# 'labels': list | ||
with open(path, 'rb') as anno_file: | ||
annotation_dict = pickle.load(anno_file, encoding='latin1') | ||
annotation_dict = pickle.load(anno_file, encoding='latin1') # nosec - disable B301:pickle check | ||
|
||
labels = annotation_dict.get('labels', []) | ||
filenames = annotation_dict.get('filenames', []) | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't say it is a problem, but this line looks a little bit extra, because the previous line outputs the version installed.