diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml new file mode 100644 index 0000000..2daf1f4 --- /dev/null +++ b/.github/workflows/scan.yml @@ -0,0 +1,79 @@ +# Shared scan baseline for uinaf repositories: secret scanning plus workflow +# lint. Repositories call this with a thin caller workflow; version bumps and +# digest pins change here, once. +# +# Every image is pinned by digest, not tag. A tag is mutable, so a version tag +# is a promise the registry can break, and each of these containers gets the +# whole repository, one of them with a token. + +name: Scan + +on: + workflow_call: + +permissions: + contents: read + +jobs: + gitleaks: + name: Gitleaks + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + - name: Scan Git history + run: | + docker run --rm --network none -v "$PWD:/repo:ro" \ + zricethezav/gitleaks@sha256:c00b6bd0aeb3071cbcb79009cb16a60dd9e0a7c60e2be9ab65d25e6bc8abbb7f \ + detect --source /repo --redact --no-banner --log-level error # v8.30.1 + + trufflehog: + name: TruffleHog + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + - name: Scan for verified secrets + run: | + docker run --rm -v "$PWD:/repo:ro" \ + trufflesecurity/trufflehog@sha256:ff4c95e9df7d645daf2140e3ca1039031c63106268d5fbb25feb43ceca1bcc33 \ + git file:///repo --no-update --fail --results=verified # 3.97.0 + + actionlint: + name: Actionlint + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Lint workflows + run: | + docker run --rm -v "$PWD:/repo" --workdir /repo \ + rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 \ + -color # 1.7.12 + + zizmor: + name: Zizmor + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + # Keep this at 1.28.0 or newer. 1.27.0 is yanked for GHSA-f42p-wjw5-97qh: + # it logs the parsed config, the GH_TOKEN below included, once verbose + # output is on. + - name: Audit workflow security + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + docker run --rm -e GH_TOKEN -v "$PWD:/repo" \ + ghcr.io/zizmorcore/zizmor@sha256:863026d54f91271b10b60b67ad8054cb37120167e162482597db102b3026a284 \ + /repo # 1.29.0