From ca137e778e839478223947889dde563fe11ea446 Mon Sep 17 00:00:00 2001 From: qinhui <> Date: Fri, 23 May 2025 10:29:46 +0800 Subject: [PATCH 1/2] gitleaks uses the local environment --- .pre-commit-config.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b06a5f51f..1b7660923 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,14 @@ repos: - - repo: https://github.com/gitleaks/gitleaks - rev: v8.24.2 - hooks: - - id: gitleaks - args: ["--config=.gitleaks.toml"] - - repo: local hooks: + - id: gitleaks + name: Detect hardcoded secrets + description: Ensures no secrets are committed + entry: gitleaks protect + args: ["--config=.gitleaks.toml", "--source", "."] + language: system + pass_filenames: false + - id: check-commit-message name: Check commit message for Chinese characters description: Ensures commit messages do not contain Chinese characters From 1e3349613790daddb183881a8f71c4430cc3851a Mon Sep 17 00:00:00 2001 From: qinhui <> Date: Fri, 23 May 2025 11:02:48 +0800 Subject: [PATCH 2/2] gitleaks uses the local environment --- .pre-commit-config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b7660923..8cca4020e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,9 +5,10 @@ repos: name: Detect hardcoded secrets description: Ensures no secrets are committed entry: gitleaks protect - args: ["--config=.gitleaks.toml", "--source", "."] + args: ["--config=.gitleaks.toml", "--staged", "--verbose"] language: system pass_filenames: false + stages: [pre-commit] - id: check-commit-message name: Check commit message for Chinese characters