fix(ci): replace gitleaks-action with manual install #50

Merged
julien merged 1 commits from fix/ci/gitleaks-manual-install into main 2026-05-08 00:05:17 +02:00
2 changed files with 77 additions and 12 deletions
+33 -3
View File
@@ -116,10 +116,40 @@ jobs:
--exit-code 1 \ --exit-code 1 \
--severity CRITICAL,HIGH \ --severity CRITICAL,HIGH \
. .
# Secret scan, same reasoning (gitleaks is a Go binary). # Secret scan. Same install pattern as Trivy: gitleaks is a Go
- uses: gitleaks/gitleaks-action@v2 # binary, and the official `gitleaks/gitleaks-action@v2` wrapper
# is now paywalled for organisations (a GITLEAKS_LICENSE secret
# from gitleaks.io is required, otherwise the action errors out
# with `🛑 missing gitleaks license`). The binary itself stays
# MIT-licensed and free — installing it directly bypasses the
# wrapper and gives us version pinning for free.
- name: Install gitleaks
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Bump deliberately. Same caveat as TRIVY_VERSION above —
# not Renovate-tracked out of the box. Releases:
# https://github.com/gitleaks/gitleaks/releases.
GITLEAKS_VERSION: '8.21.0'
GITHUB_TOKEN: ${{ secrets.GITHUBCOM_TOKEN }}
run: |
curl -sfL \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-o /tmp/gitleaks.tar.gz \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
tar -xzf /tmp/gitleaks.tar.gz -C /usr/local/bin gitleaks
gitleaks version
- name: Run gitleaks
# `--no-git --source .` scans the working tree only. The scan
# job uses a shallow checkout, so a git-history scan would not
# see beyond HEAD anyway; the weekly security-scheduled
# workflow does the deep history scan with a full clone.
# `--redact` masks any matched secret in the log output so we
# do not leak it via the CI logs themselves.
run: |
gitleaks detect \
--no-git \
--source . \
--redact \
--exit-code 1
commits: commits:
# PRs opened by Renovate (apf-portal-bot) carry commit messages # PRs opened by Renovate (apf-portal-bot) carry commit messages
+44 -9
View File
@@ -15,24 +15,60 @@ jobs:
full-tree-scan: full-tree-scan:
runs-on: [self-hosted, on-prem] runs-on: [self-hosted, on-prem]
steps: steps:
# fetch-depth: 0 → full history. The per-PR gitleaks scan is
# shallow + working-tree-only; this scheduled job is where we
# do the deep history scan that catches secrets ever committed
# (and not just what's currently checked in).
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: pnpm/action-setup@v6 - uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- run: pnpm audit - run: pnpm audit
# Full-tree Trivy (no skip-dirs, no severity filter — the per-PR # Full-tree Trivy (no skip-dirs, no severity filter — the per-PR
# gate filters by severity for speed; this run wants the full # gate filters by severity for speed; this run wants the full
# surface for the security feed). # surface for the security feed). Manual install + curl, same
- uses: aquasecurity/trivy-action@master # pattern as ci.yml — see the rationale there.
with: - name: Install Trivy
scan-type: fs
ignore-unfixed: true
- uses: gitleaks/gitleaks-action@v2
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TRIVY_VERSION: '0.70.0'
GITHUB_TOKEN: ${{ secrets.GITHUBCOM_TOKEN }}
run: |
curl -sfL \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-o /tmp/trivy.tar.gz \
"https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
tar -xzf /tmp/trivy.tar.gz -C /usr/local/bin trivy
trivy --version
- name: Run Trivy
run: |
trivy fs \
--scanners vuln \
--ignore-unfixed \
.
# Deep gitleaks scan (full git history). Same install pattern as
# ci.yml. `--redact` masks any matched secret in the log so we
# don't leak it via CI logs themselves.
- name: Install gitleaks
env:
GITLEAKS_VERSION: '8.21.0'
GITHUB_TOKEN: ${{ secrets.GITHUBCOM_TOKEN }}
run: |
curl -sfL \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-o /tmp/gitleaks.tar.gz \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
tar -xzf /tmp/gitleaks.tar.gz -C /usr/local/bin gitleaks
gitleaks version
- name: Run gitleaks (full history)
run: |
gitleaks detect \
--source . \
--redact \
--exit-code 1
lighthouse-prod: lighthouse-prod:
# Skipped silently if the prod URL hasn't been configured yet. # Skipped silently if the prod URL hasn't been configured yet.
@@ -44,7 +80,6 @@ jobs:
- uses: actions/setup-node@v6 - uses: actions/setup-node@v6
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- run: pnpm exec lhci collect --url=${{ vars.LHCI_PROD_URL }} --numberOfRuns=3 - run: pnpm exec lhci collect --url=${{ vars.LHCI_PROD_URL }} --numberOfRuns=3
- run: pnpm exec lhci assert --config=./lighthouserc.js - run: pnpm exec lhci assert --config=./lighthouserc.js