From 92e01ba48c1133c63df285bd2b4d54a57e6c2522 Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Sun, 6 Dec 2026 18:47:53 +0100 Subject: [PATCH] fix(ci): keep packaging files and shebang noise out of the shell scan --- .gitea/workflows/security.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/security.yml b/.gitea/workflows/security.yml index a007aae..5d9209e 100644 --- a/.gitea/workflows/security.yml +++ b/.gitea/workflows/security.yml @@ -75,26 +75,32 @@ jobs: - name: Collect the shell scripts run: | set -euo pipefail - git ls-files -z '*.sh' '*.bash' 'PKGBUILD' > "$RUNNER_TEMP/scripts" + # PKGBUILD files are bash without a shebang, so shellcheck would report + # SC2148 on every one of them: makepkg sources them, the gate does not. + git ls-files -z '*.sh' '*.bash' > "$RUNNER_TEMP/scripts" printf '%s shell files to check\n' "$(tr -cd '\0' < "$RUNNER_TEMP/scripts" | wc -c)" # SC2086/SC2046 and friends are the shapes an injection takes in shell. # They stay advisory for now: existing scripts would turn the gate red on - # their first run, so warnings are reported and errors block. + # their first run, so warnings are reported and errors block. SC2148 (no + # shebang) and SC2068 (array quoting, inherited from vendored shell + # integrations) are not signals this gate can act on. - name: Shellcheck warnings (advisory) continue-on-error: true run: | set -o pipefail [ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; } xargs -0 -a "$RUNNER_TEMP/scripts" -r \ - "$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --format=gcc --severity=warning + "$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --format=gcc --severity=warning \ + --exclude=SC2148,SC2068 - name: Shellcheck errors run: | set -euo pipefail [ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; } xargs -0 -a "$RUNNER_TEMP/scripts" -r \ - "$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --severity=error + "$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --severity=error \ + --exclude=SC2148,SC2068 sast: name: sast