#!/usr/bin/env bash # Secret scan for CI (copy to .gitea/scripts/gitleaks.sh): gitleaks over the # whole history of every branch the checkout has, with .gitleaks.toml and # .gitleaksignore. A full scan of a few hundred commits takes about a second, # so every push checks every commit. Exit 1 on a finding; --redact keeps the # value out of the log. Bump VERSION and SHA256 together (checksums.txt of # the release, line for linux_x64.tar.gz). set -euo pipefail VERSION=8.30.1 SHA256=551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb # linux_x64 dir=$(mktemp -d) tarball="gitleaks_${VERSION}_linux_x64.tar.gz" curl -fsSL --retry 3 -o "$dir/$tarball" \ "https://github.com/gitleaks/gitleaks/releases/download/v${VERSION}/${tarball}" echo "$SHA256 $dir/$tarball" | sha256sum -c --quiet - tar -xzf "$dir/$tarball" -C "$dir" gitleaks "$dir/gitleaks" git . --redact --no-banner --verbose --exit-code 1 \ --log-opts="--all"