forked from mdegis/bandit-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·70 lines (59 loc) · 1.01 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#./entrypoint.sh . high high ./.venv 0 DEFAULT DEFAULT format path has_bandit_yaml
bandit --version
UPPERCASE_LEVEL=$(echo $2 | tr a-z A-Z)
case $UPPERCASE_LEVEL in
LOW)
LEVEL="-l"
;;
MEDIUM | MID)
LEVEL="-ll"
;;
HIGH)
LEVEL="-lll"
;;
*)
LEVEL=""
;;
esac
UPPERCASE_CONFIDENCE=$(echo $3 | tr a-z A-Z)
case $UPPERCASE_CONFIDENCE in
LOW)
CONFIDENCE="-i"
;;
MEDIUM | MID)
CONFIDENCE="-ii"
;;
HIGH)
CONFIDENCE="-iii"
;;
*)
CONFIDENCE=""
;;
esac
if [ "$4" == "DEFAULT" ]; then
EXCLUDED_PATHS=""
else
EXCLUDED_PATHS="-x $4"
fi
if [ "$5" == "DEFAULT" ]; then
EXIT_ZERO=""
else
EXIT_ZERO="--exit-zero"
fi
if [ "$6" == "DEFAULT" ]; then
SKIPS=""
else
SKIPS="-s $6"
fi
if [ "$7" == "DEFAULT" ]; then
INI_PATH=""
else
INI_PATH="--ini $7"
fi
if [ "${10}" == "true" ]; then
USE_BANDIT_YAML="-c bandit.yaml"
else
USE_BANDIT_YAML=""
fi
bandit -f $8 -o $9 -r $1 $LEVEL $CONFIDENCE $EXCLUDED_PATHS $EXIT_ZERO $SKIPS $INI_PATH $USE_BANDIT_YAML --exit-zero