Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .github/workflows/secret-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ on:
permissions:
contents: read

env:
GITLEAKS_VERSION: 8.30.1
# sha256 of gitleaks_8.30.1_linux_x64.tar.gz, equal to the line in the release's checksums file.
GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb

jobs:
gitleaks:
name: Secret scan (gitleaks)
Expand All @@ -31,14 +26,7 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: Install gitleaks (pinned version and checksum)
run: |
set -euo pipefail
file="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
curl --proto '=https' --tlsv1.2 -fsSL -o "$RUNNER_TEMP/$file" \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/${file}"
echo "${GITLEAKS_SHA256} $RUNNER_TEMP/$file" | sha256sum --check -
mkdir "$RUNNER_TEMP/gitleaks"
tar -xzf "$RUNNER_TEMP/$file" -C "$RUNNER_TEMP/gitleaks" gitleaks
run: bash scripts/secret-scan/install-linux.sh
- name: Scan the history
# Only the history reachable from the commit this run checked out, never every branch that
# fetch-depth 0 brought in: a throwaway test branch must not fail other pushes or pull requests.
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ jobs:
echo "changed=true" >> "$GITHUB_OUTPUT"
git diff --cached --stat
fi
- name: Scan the staged documentation
if: steps.changes.outputs.changed == 'true'
# A push by the workflow token does not run the push-triggered Secret scan.
run: |
bash scripts/secret-scan/install-linux.sh
"$RUNNER_TEMP/gitleaks/gitleaks" git --staged --redact --no-banner \
--config .gitleaks.toml --exit-code 1
- name: Check the new pages build
if: steps.changes.outputs.changed == 'true'
run: pnpm verify
Expand Down
14 changes: 14 additions & 0 deletions scripts/secret-scan/install-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail

# The linux_x64 archive checksum from the pinned Gitleaks release.
version=8.30.1
sha256=551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
file="gitleaks_${version}_linux_x64.tar.gz"
archive="${RUNNER_TEMP:?}/$file"

curl --proto '=https' --tlsv1.2 -fsSL -o "$archive" \
"https://github.com/gitleaks/gitleaks/releases/download/v${version}/$file"
printf '%s %s\n' "$sha256" "$archive" | sha256sum --check -
mkdir "$RUNNER_TEMP/gitleaks"
tar -xzf "$archive" -C "$RUNNER_TEMP/gitleaks" gitleaks
Loading