Skip to content

Commit

Permalink
fix(build): Install requirements.txt before Pipfile lock gen
Browse files Browse the repository at this point in the history
  • Loading branch information
bigpick committed Aug 23, 2024
1 parent 19d08c9 commit d271bbc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Makefile.ibm
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ trivy-scan-python-vulnerabilities:

# Generate a Pipfile.lock, Trivy does not auto-detect requirements-dev.txt (https://aquasecurity.github.io/trivy/v0.28.1/docs/vulnerability/detection/language/)
#./scripts/gen-pipfile.sh > Pipfile
#pipenv --python `which python3`
#pipenv lock
$(TRIVY) fs --exit-code 1 --ignore-unfixed --scanners vuln --file-patterns 'pip:requirements*.txt' ./
pipenv --python `which python3`
pipenv install -r requirements-dev.txt
pipenv lock
$(TRIVY) fs --exit-code 1 --ignore-unfixed --scanners vuln --file-patterns ./

docker-quality-images:
for image_name in $(DOCKER_IMAGES_TO_SCAN) ; do \
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/core/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize(
:param plugins: rules to initialize the SecretsCollection with.
:type plugins_reuse_excludes: bool|None
:param plugins_reuse_excludes optional bool indicating whether plugins were forced to reuse excludes.
:param plugins_reuse_excludes optional bool whether plugins were forced to reuse excludes.
:type exclude_files_regex: str|None
:type exclude_lines_regex: str|None
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/core/secrets_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def format_for_baseline_output(self):
plugins_used = sorted(plugins_used, key=lambda x: x['name'])

return {
**({"plugins_reuse_excludes": True} if self.plugins_reuse_excludes else {}),
**({'plugins_reuse_excludes': True} if self.plugins_reuse_excludes else {}),
'generated_at': strftime('%Y-%m-%dT%H:%M:%SZ', gmtime()),
'exclude': {
'files': self.exclude_files,
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/core/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def add_plugins_reuse_excludes_flag(parser):
parser.add_argument(
'--plugins-reuse-excludes',
action='store_true',
help='Force plugins to try re-using existing exclude contents.'
help='Force plugins to try re-using existing exclude contents.',
)


Expand Down
11 changes: 6 additions & 5 deletions detect_secrets/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ def maybe_get_existing_exclude(exclude_files, exclude_lines, old_baseline):
if not old_baseline:
return exclude_files, exclude_lines

previously_included = old_baseline.get("exclude", None)
previously_included = old_baseline.get('exclude', None)
if not previously_included:
return exclude_files, exclude_lines

files = "|".join(filter(None, (exclude_files, previously_included.get("files",None))))
lines = "|".join(filter(None, (exclude_lines, previously_included.get("lines",None))))
files = '|'.join(filter(None, (exclude_files, previously_included.get('files', None))))
lines = '|'.join(filter(None, (exclude_lines, previously_included.get('lines', None))))

return files, lines


def main(argv=None):
if len(sys.argv) == 1: # pragma: no cover
sys.argv.append('-h')
Expand All @@ -50,8 +51,8 @@ def main(argv=None):
automaton, word_list_hash = build_automaton(args.word_list_file)

_baseline = _get_existing_baseline(args.import_filename, args.string)
if args.plugins_reuse_excludes or (_baseline and _baseline.get("plugins_reuse_excludes", False)):
args.exclude_files, args.exclude_lines = maybe_get_existing_exclude(args.exclude_files, args.exclude_lines, _baseline)
if args.plugins_reuse_excludes or (_baseline and _baseline.get('plugins_reuse_excludes', False)): # noqa: E501
args.exclude_files, args.exclude_lines = maybe_get_existing_exclude(args.exclude_files, args.exclude_lines, _baseline) # noqa: E501

# Plugins are *always* rescanned with fresh settings, because
# we want to get the latest updates.
Expand Down

0 comments on commit d271bbc

Please sign in to comment.