|
| 1 | +name: Security and Hygiene |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + |
| 9 | +env: |
| 10 | + GITLEAKS_VERSION: 8.24.3 |
| 11 | + SHELLCHECK_VERSION: 0.10.0 |
| 12 | + HADOLINT_VERSION: 2.12.0 |
| 13 | + |
| 14 | +jobs: |
| 15 | + gitleaks: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + name: gitleaks PR secret scan |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install gitleaks |
| 22 | + run: | |
| 23 | + set -euo pipefail |
| 24 | + mkdir -p "${RUNNER_TEMP}/bin" |
| 25 | + curl -sSfL \ |
| 26 | + -o "${RUNNER_TEMP}/gitleaks.tar.gz" \ |
| 27 | + "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" |
| 28 | + tar -xzf "${RUNNER_TEMP}/gitleaks.tar.gz" -C "${RUNNER_TEMP}/bin" gitleaks |
| 29 | + echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}" |
| 30 | +
|
| 31 | + - name: Scan current tree |
| 32 | + run: gitleaks detect --no-git --source . --redact --verbose |
| 33 | + |
| 34 | + shellcheck: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + name: shellcheck checked-in scripts |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Install shellcheck |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + mkdir -p "${RUNNER_TEMP}/bin" |
| 44 | + curl -sSfL \ |
| 45 | + -o "${RUNNER_TEMP}/shellcheck.tar.xz" \ |
| 46 | + "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" |
| 47 | + tar -xJf "${RUNNER_TEMP}/shellcheck.tar.xz" \ |
| 48 | + -C "${RUNNER_TEMP}/bin" \ |
| 49 | + --strip-components=1 \ |
| 50 | + "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" |
| 51 | + echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}" |
| 52 | +
|
| 53 | + - name: Lint checked-in shell scripts |
| 54 | + run: | |
| 55 | + set -euo pipefail |
| 56 | + mapfile -d '' scripts < <(find . -type f -name '*.sh' -not -path './tmp/*' -print0) |
| 57 | + shellcheck "${scripts[@]}" |
| 58 | +
|
| 59 | + hadolint: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + name: hadolint Dockerfiles |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + |
| 65 | + - name: Install hadolint |
| 66 | + run: | |
| 67 | + set -euo pipefail |
| 68 | + mkdir -p "${RUNNER_TEMP}/bin" |
| 69 | + curl -sSfL \ |
| 70 | + -o "${RUNNER_TEMP}/bin/hadolint" \ |
| 71 | + "https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-Linux-x86_64" |
| 72 | + chmod +x "${RUNNER_TEMP}/bin/hadolint" |
| 73 | + echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}" |
| 74 | +
|
| 75 | + - name: Lint Dockerfiles |
| 76 | + run: | |
| 77 | + set -euo pipefail |
| 78 | + mapfile -d '' dockerfiles < <(find . -type f \( -name 'Dockerfile' -o -name 'Dockerfile.*' \) -print0) |
| 79 | + hadolint "${dockerfiles[@]}" |
| 80 | +
|
| 81 | + helm-golden-render: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + name: Helm golden renders |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v4 |
| 86 | + |
| 87 | + - name: Setup Helm |
| 88 | + uses: azure/setup-helm@v4 |
| 89 | + with: |
| 90 | + version: v3.12.1 |
| 91 | + |
| 92 | + - name: Check high-risk preset renders |
| 93 | + run: .github/scripts/check-helm-golden-renders.sh |
0 commit comments