From 42d3eb4b6071abdc1b9b828f63ea12ee82dd1193 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 16 Oct 2024 04:18:30 +1000 Subject: [PATCH] Add `pre-commit` hook `gitleaks` to detect and prevent hardcoded secrets https://github.com/gitleaks/gitleaks Adding another check/test to our pre-commit framework. gitleaks is a popular tool that helps with security. Removes the gitleaks check from the Super-Linter. So now we can run gitleaks with pre-commit on `git commit` --- .github/workflows/super-linter.yml | 1 - .pre-commit-config.yaml | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 53bb7c437..b668c1a16 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -25,7 +25,6 @@ jobs: # VALIDATE_BASH_EXEC: true VALIDATE_DOCKERFILE_HADOLINT: true # VALIDATE_EDITORCONFIG: true - VALIDATE_GITLEAKS: true # VALIDATE_SHELL_SHFMT: true DEFAULT_BRANCH: master GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec071da8d..0e046e9d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,10 @@ repos: hooks: - id: identity - id: check-hooks-apply + - repo: https://github.com/gitleaks/gitleaks + rev: v8.20.1 + hooks: + - id: gitleaks - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: