Skip to content

Commit

Permalink
csfilter-kfp: fix an over-quoted regex
Browse files Browse the repository at this point in the history
... which prevented empty lines in `exlude-paths.txt` from being
skipped.

Resolves: https://issues.redhat.com/browse/OSH-755
  • Loading branch information
kdudka committed Sep 12, 2024
1 parent d1e25e8 commit 17922cc
Show file tree
Hide file tree
Showing 7 changed files with 2,634 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/csfilter-kfp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def construct_path_filter(args):
cmd += ' re=\n'
cmd += ' while read line; do\n'
cmd += ' re="${re}|(${line})"\n'
cmd += ' done < <(grep -Esv "^(#|\\\\$)" "$ep")\n'
cmd += ' done < <(grep -Esv \'^(#|$)\' "$ep")\n'
cmd += ' if test -n "$re"; then\n'
cmd += ' csgrep --mode=json --invert-match --path="${re#|}"\n'
cmd += ' else\n'
Expand Down
2 changes: 1 addition & 1 deletion tests/csfilter-kfp/0002-stdout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ path_filter() {
re=
while read line; do
re="${re}|(${line})"
done < <(grep -Esv "^(#|\\$)" "$ep")
done < <(grep -Esv '^(#|$)' "$ep")
if test -n "$re"; then
csgrep --mode=json --invert-match --path="${re#|}"
else
Expand Down
1 change: 1 addition & 0 deletions tests/csfilter-kfp/0004-args.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--kfp-dir "$PROJECT_ROOT/tests/csfilter-kfp/0004-kfp" --project-nvr WALinuxAgent-2.7.0.6-8.el8_8
4 changes: 4 additions & 0 deletions tests/csfilter-kfp/0004-kfp/WALinuxAgent/exclude-paths.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

WALinuxAgent[^/]*/dcr/.*
# dcr' is a testing pipeline for WALA and it is packaged by an oversight, the code is not used. It was removed in the current upstream so this will be gone with WALA rebase.

10 changes: 10 additions & 0 deletions tests/csfilter-kfp/0004-kfp/WALinuxAgent/ignore.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

Error: SNYK_CODE_WARNING (CWE-547):
WALinuxAgent-2.7.0.6/azurelinuxagent/common/utils/cryptutil.py:33:1: error[python/HardcodedNonCryptoSecret]: Avoid hardcoding values that are meant to be secret. Found a hardcoded string used in here.
# 31|
# 32|
# 33|-> DECRYPT_SECRET_CMD = "{0} cms -decrypt -inform DER -inkey {1} -in /dev/stdin"
# 34|
# 35|
# DECRYPT_SECRET_CMD is not a hardcoded secret, it is a openssl command template, there's nothing secret in it.

Loading

0 comments on commit 17922cc

Please sign in to comment.