fix: auto-approve PRs from attune-release-bot #752
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Security | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| merge_group: {} | |
| workflow_dispatch: {} | |
| schedule: | |
| - cron: "0 6 * * 1" # Weekly Monday 6am UTC | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: security-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| codeql: | |
| name: CodeQL (${{ matrix.language }}) | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - language: go | |
| build-mode: manual | |
| - language: actions | |
| build-mode: none | |
| steps: | |
| - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| if: matrix.language == 'go' | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 | |
| with: | |
| languages: ${{ matrix.language }} | |
| build-mode: ${{ matrix.build-mode }} | |
| queries: security-and-quality | |
| dependency-caching: true | |
| - name: Build (Go) | |
| if: matrix.build-mode == 'manual' | |
| run: go build ./... | |
| - uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 | |
| with: | |
| upload: always | |
| category: "/language:${{ matrix.language }}" | |
| govulncheck: | |
| name: Govulncheck | |
| runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - uses: ./.github/actions/install-go-tool | |
| with: | |
| name: govulncheck | |
| version: v1.3.0 | |
| package: golang.org/x/vuln/cmd/govulncheck | |
| - name: Run govulncheck | |
| shell: bash -Eeuo pipefail -x {0} | |
| run: govulncheck ./... | |
| trivy: | |
| name: Trivy | |
| runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-clean-docker-config | |
| - name: Trivy filesystem scan | |
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | |
| with: | |
| scan-type: fs | |
| scan-ref: . | |
| scanners: vuln | |
| severity: HIGH,CRITICAL | |
| exit-code: 1 | |
| ignore-unfixed: true | |
| trivy-image: | |
| name: Trivy Image Scan | |
| runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - uses: ./.github/actions/setup-clean-docker-config | |
| - name: Build image for scanning | |
| shell: bash -Eeuo pipefail -x {0} | |
| run: | | |
| scan_tar="${RUNNER_TEMP:-/tmp}/attune-scan-${GITHUB_RUN_ID}-${GITHUB_JOB}.tar" | |
| # The Dockerfile uses FROM --platform=$BUILDPLATFORM which requires | |
| # BuildKit (buildx). Ensure buildx is usable, then build. | |
| # The Dockerfile uses --platform=$BUILDPLATFORM which requires BuildKit. | |
| # When buildx is available, use it directly. Otherwise, strip the | |
| # --platform directives (only needed for cross-compilation) and build | |
| # natively with the legacy builder. | |
| if docker buildx version &>/dev/null; then | |
| # Use --load (loads into local daemon) then docker save, | |
| # because --output type=docker is not supported by the | |
| # default docker driver on GitHub-hosted runners. | |
| docker buildx build --load -t attune:scan . | |
| docker save attune:scan -o "$scan_tar" | |
| else | |
| # Strip BuildKit-only features for a legacy-builder native build: | |
| # --platform=$VAR from FROM, --mount=type=cache,... from RUN, | |
| # and the # syntax= directive. | |
| sed -e 's/--platform=[^[:space:]]*//' -e '/^# syntax=/d' Dockerfile \ | |
| | awk '/^RUN --mount/ { printf "RUN "; next } /^[[:space:]]+--mount/ { next } { print }' \ | |
| > "${RUNNER_TEMP}/Dockerfile.scan" | |
| docker build -f "${RUNNER_TEMP}/Dockerfile.scan" -t attune:scan . | |
| docker save attune:scan -o "$scan_tar" | |
| fi | |
| - name: Trivy image scan | |
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | |
| with: | |
| input: ${{ runner.temp }}/attune-scan-${{ github.run_id }}-${{ github.job }}.tar | |
| severity: HIGH,CRITICAL | |
| exit-code: 1 | |
| ignore-unfixed: true | |
| - name: Cleanup scan artifacts | |
| if: always() | |
| shell: bash -Eeuo pipefail {0} | |
| run: rm -f "${RUNNER_TEMP:-/tmp}/attune-scan-${GITHUB_RUN_ID}-${GITHUB_JOB}.tar" | |
| gitleaks: | |
| name: Gitleaks | |
| runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: ./.github/actions/install-binary-tool | |
| with: | |
| name: gitleaks | |
| version: "8.30.1" | |
| install-command: | | |
| OS="$(uname -s | tr '[:upper:]' '[:lower:]')" | |
| ARCH="$(uname -m)" | |
| case "$ARCH" in | |
| x86_64) ARCH="x64" ;; | |
| aarch64|arm64) ARCH="arm64" ;; | |
| esac | |
| curl -sfL "https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_${OS}_${ARCH}.tar.gz" \ | |
| | tar xz -C "$TOOL_DIR" gitleaks | |
| - name: Detect secrets | |
| shell: bash -Eeuo pipefail -x {0} | |
| run: gitleaks detect --source . --exit-code 1 | |
| dependency-review: | |
| name: Dependency Review | |
| runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 10 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 | |
| with: | |
| fail-on-severity: high |