Repository navigation
feat: add lefthook pre-commit hook with gitleaks secret scanning - #319
Merged
Merged
Conversation
Part of the Git Hooks RFC rollout (bcgov/entity#34619). Adds lefthook as a dev dependency with a pre-commit hook that runs gitleaks against staged changes, plus a .gitleaks.toml allowlisting known false positives.
kialj876
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the Git Hooks RFC rollout (bcgov/entity#34619).
Adds a pre-commit hook that runs gitleaks on staged changes.
lefthook.yml- secret scan only vianpx gitleaks-secret-scannerpackage.json-lefthookdev dependency only. Nopreparescript needed: lefthook's own npm postinstall installs the hook.package-lock.json- only the 11 lefthook entries added (165 lines, 0 removed).npm install -Dalso wanted to prune/re-flag unrelated entries - all left out on purpose. Checked:npm ciaccepts it (lock in sync)..gitleaks.toml- gitleaks default rules plus narrow allowlists for false positives found by scanning the whole repo:docs/assets/- generated Storybook build output (npm run build-storybook). The minified bundle contains the GenesysdeploymentKeyfrom the stories, so without this every docs rebuild would be blockeddeploymentKeylines inGenesysWebMessage.stories.ts(public widget ids, but left visible rather than blanket-allowlisting a key name). Hook only checks changed lines, so no impact unless edited.To get the hook: Run
npm install(ornpm ci) once.Build safety: lefthook's postinstall skips itself when
CIis set (GitHub Actions), and otherwise never fails the install - it runslefthook installin a try/catch viaspawnSync. Checked by installing the way the Dockerfile does (onlypackage*.json, no.git):lefthook installitself errors (not a git repository, exit 1) butnpm cistill exits 0. Same with no git binary at all.Tested
Windows, real
git commit:npm ci→ exit 0, hook installed by lefthook's postinstallsrc/→ blocked