diff --git a/.github/workflows/node-security-dependency-scan.yml b/.github/workflows/node-security-dependency-scan.yml index 0a470df..f31fc2d 100644 --- a/.github/workflows/node-security-dependency-scan.yml +++ b/.github/workflows/node-security-dependency-scan.yml @@ -181,9 +181,11 @@ jobs: run: | if [ -d reports ] && [ -n "$(ls -A reports 2>/dev/null)" ]; then echo "::warning title=OWASP Dependency Check::Report generated - download the 'owasp-dependency-check-report' artifact to review findings." - echo "## OWASP Dependency Check" >> "$GITHUB_STEP_SUMMARY" - echo "" >> "$GITHUB_STEP_SUMMARY" - echo "Report available as the \`owasp-dependency-check-report\` artifact." >> "$GITHUB_STEP_SUMMARY" + { + echo "## OWASP Dependency Check" + echo "" + echo "Report available as the \`owasp-dependency-check-report\` artifact." + } >> "$GITHUB_STEP_SUMMARY" else echo "::warning title=OWASP Dependency Check::No report was produced - the scan may not have completed." fi diff --git a/.github/workflows/self-scan.yml b/.github/workflows/self-scan.yml new file mode 100644 index 0000000..41d75bc --- /dev/null +++ b/.github/workflows/self-scan.yml @@ -0,0 +1,81 @@ +# This repository ships reusable workflows, so nothing here ran against +# itself - changes were only exercised once they had already landed in every +# consuming repo. This runs them on this repo instead, and lints the workflow +# files, so a broken change is caught here rather than downstream. +# +# Runs on every branch, not just main. Consumers pick up `@main` the instant +# it lands, so a signal that only arrives after merge is already too late. +# +# The jobs below reference the workflows by local path (`./.github/...`) +# rather than `@main`. That is deliberate and is what makes this test the +# *current* version: GitHub resolves a local reusable-workflow reference +# against the same commit as the caller, so a push to any branch exercises +# that branch's copy. Using `@main` here would test the already-merged +# version and defeat the point. +name: Self Scan + +on: + push: + branches: ["**"] + +permissions: + contents: read + +env: + ACTIONLINT_VERSION: "1.7.12" + +jobs: + # Dogfood the secret scanner on this repository. + # + # notify_webhook is off: this repo has no SECURITY_WEBHOOK_URL secret, and + # validate-inputs correctly fails when notifications are on without one. + # + # node-security-dependency-scan.yml is deliberately NOT called here - it + # runs `npm ci`, and this repository has no package.json, so it would fail + # for reasons that say nothing about whether the workflow is correct. + secret-scan: + uses: ./.github/workflows/security.yml + with: + notify_webhook: false + scan_filesystem: true + show_keys: false + + # Catches invalid workflow syntax, bad expressions, unknown contexts, and - + # via shellcheck - bugs in the inline `run:` scripts, which is where the + # real logic in this repo lives. + lint-workflows: + name: Lint workflows + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install actionlint + run: | + set -euo pipefail + + BINARY="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" + CHECKSUMS="actionlint_${ACTIONLINT_VERSION}_checksums.txt" + BASE="https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}" + + TEMP_DIR=$(mktemp -d) + cd "$TEMP_DIR" + + curl -sSfL -o "$BINARY" "${BASE}/${BINARY}" + curl -sSfL -o "$CHECKSUMS" "${BASE}/${CHECKSUMS}" + + # Verified rather than trusted, and installed from a pinned release + # instead of a third-party action, matching how TruffleHog is + # installed in security.yml. + grep " ${BINARY}\$" "$CHECKSUMS" | sha256sum -c - + + tar -xzf "$BINARY" actionlint + sudo install -m 755 actionlint /usr/local/bin/actionlint + cd / && rm -rf "$TEMP_DIR" + + actionlint --version + + - name: Run actionlint + run: actionlint -color