restructuring logic and adding more inputs #2
@@ -49,4 +49,9 @@ runs:
|
|||||||
|
|
||||||
- name: "run security checks"
|
- name: "run security checks"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ${{ github.action_path }}/src/security.sh
|
run: ${{ github.action_path }}/src/security.sh
|
||||||
|
env:
|
||||||
|
STATIC_FLAG: ${{ inputs.static }}
|
||||||
|
STATIC_FAIL: ${{ inputs.static-fail }}
|
||||||
|
VULN_CHECK: ${{ inputs.vulnerability }}
|
||||||
|
VULN_FAIL: ${{ inputs.vulnerability-fail }}
|
||||||
@@ -2,13 +2,19 @@
|
|||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
if [[ "$STATIC_FLAG" == "no" && "$VULN_SCAN" == "no" ]]; then
|
if [[ "$STATIC_FLAG" == "no" && "$VULN_CHECK" == "no" ]]; then
|
||||||
echo "[INFO] no security flags set, skipping!";
|
echo "[INFO] no security flags set, skipping!";
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
toolchain=$(go mod edit go.mod -json | jq ".Toolchain");
|
||||||
|
version=$(go mod edit -json | jq ".Toolchain");
|
||||||
|
if [[ ! -z "$toolchain" ]]; then
|
||||||
|
version=$toolchain;
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$STATIC_FLAG" == "yes" ]]; then
|
if [[ "$STATIC_FLAG" == "yes" ]]; then
|
||||||
if gosec ./...; then
|
if GOTOOLCHAIN=$version gosec ./...; then
|
||||||
echo "[INFO] gosec passed!";
|
echo "[INFO] gosec passed!";
|
||||||
else
|
else
|
||||||
if [[ "$STATIC_FAIL" == "yes" ]]; then
|
if [[ "$STATIC_FAIL" == "yes" ]]; then
|
||||||
@@ -21,7 +27,7 @@ if [[ "$STATIC_FLAG" == "yes" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$VULN_CHECK" == "yes" ]]; then
|
if [[ "$VULN_CHECK" == "yes" ]]; then
|
||||||
if govulncheck ./...; then
|
if GOTOOLCHAIN=$version govulncheck ./...; then
|
||||||
echo "[INFO] govulncheck passed!";
|
echo "[INFO] govulncheck passed!";
|
||||||
else
|
else
|
||||||
if [[ "$VULN_FAIL" == "yes" ]]; then
|
if [[ "$VULN_FAIL" == "yes" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user