Skip to content

feat: use shared gitleaks rules from bcregistry-sre - #285

Merged
panish16 merged 1 commit into
mainfrom
feat/shared-gitleaks-rules
Oct 14, 2026
Merged

panish16 merged 1 commit into
mainfrom
feat/shared-gitleaks-rules

Conversation

@panish16

Copy link
Copy Markdown
Collaborator

Part of the Git Hooks RFC rollout (bcgov/entity#34619).

Switches the hook to the shared gitleaks rules in bcgov/bcregistry-sre (git-hooks/, added in bcgov/bcregistry-sre#407), same as bcgov/ppr#2380. Rule changes now get made once in sre and every repo picks them up within a day.

  • lefthook.yml - adds the bcregistry-sre remotes: entry. The scan blocks the commit if the shared rules haven't been downloaded yet, instead of scanning with no rules.
  • .gitleaks.toml - extends the shared rules (gitleaks defaults + Patrick's hardcoded-password + Thor's custom-password) instead of just the defaults. No new allowlist entries needed - the password rules find nothing new in the existing tree.
  • README.md - one sentence on where the rules come from + the Windows long-paths note.

Also fixes the hook on main: the pre-commit lint command (npx -y lint-staged, from #281) has no lint-staged config in this repo, so it fails every commit touching js/ts/vue/css/md for anyone with hooks installed (checked on a clean clone of main). Removed it - linting stays in CI, same as ppr after its lint step was dropped. With this PR .md/.ts commits go through and secrets are still blocked.

Nothing changes for setup: pnpm install at the repo root once. On Windows run git config --global core.longpaths true once first.

Tested

Real git commit on Windows, pnpm 11.9.0, fresh clone:

  • whole-repo scan: same findings as today, 0 new
  • os.getenv(...), process.env.X → commit fine
  • literal password in Python / YAML / TS, fake GitHub token → blocked
  • shared rules not downloaded (GitHub unreachable, or partial download without core.longpaths) → blocked with "Shared gitleaks rules missing", recovers once fixed

Doesn't touch app code, so CI/build should be unaffected.

Pulls the gitleaks rules from bcgov/bcregistry-sre (git-hooks/, added in
bcregistry-sre#407) via lefthook remotes, same as ppr#2380. This adds the
shared hardcoded-password and custom-password rules on top of the gitleaks
defaults; .gitleaks.toml now extends the shared base and keeps only this
repo's own allowlist. The secret-scan command blocks the commit if the
shared rules haven't been downloaded, instead of scanning with no rules.

Also drops the pre-commit lint command: there is no lint-staged config in
this repo, so it failed every commit touching js/ts/vue/css/md. Linting
stays in CI, same as ppr after the lint step was removed there.
@panish16
panish16 merged commit fea8ade into main Oct 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants