Skip to content

Chore: [AEA-0000] - use gitleaks for secret scanning#98

Open
anthony-nhs wants to merge 4 commits intomainfrom
gitleaks
Open

Chore: [AEA-0000] - use gitleaks for secret scanning#98
anthony-nhs wants to merge 4 commits intomainfrom
gitleaks

Conversation

@anthony-nhs
Copy link
Copy Markdown
Contributor

use gitleaks for secret scanning

Copilot AI review requested due to automatic review settings April 17, 2026 10:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository’s local developer tooling to use gitleaks for secret scanning (replacing git-secrets) and adjusts related configuration.

Changes:

  • Add a new local pre-commit hook to run grype-scan-local.
  • Replace the git-secrets pre-commit hook with a gitleaks pre-commit hook.
  • Remove the .gitallowed allowlist file (previously used by git-secrets).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.pre-commit-config.yaml Adds a Grype hook and replaces git-secrets with gitleaks in pre-commit configuration.
.gitallowed Removes the git-secrets allowlist file.

Comment thread .pre-commit-config.yaml
args: ["grype-scan-local"]
language: system
pass_filenames: false
always_run: true
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always_run: true means the Grype scan will run on every commit regardless of what changed, and since it ultimately scans the whole repository (grype .) this can add significant overhead to the commit path. If the goal is to scan only when dependency-relevant files change, consider removing always_run and using files:/types: filters (or keeping it always-run but clearly documenting the performance impact in the hook name/description).

Suggested change
always_run: true
files: ^(Dockerfile|docker-compose\.ya?ml|requirements(\.txt|/.*\.txt)?|poetry\.lock|pyproject\.toml|Pipfile(\.lock)?|setup\.(py|cfg)|package(-lock)?\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|go\.(mod|sum)|Cargo\.(toml|lock)|Gemfile(\.lock)?|pom\.xml|build\.gradle(\.kts)?|gradle\.properties|gradle/libs\.versions\.toml|composer\.(json|lock)|\.github/workflows/.*\.ya?ml)$

Copilot uses AI. Check for mistakes.
Comment thread .pre-commit-config.yaml
Comment on lines +53 to +58
name: Git Leaks
description: gitleaks scans commits, commit messages, and --no-ff merges to prevent adding secrets into your git repositories.
entry: bash
args:
- -c
- 'git-secrets --pre_commit_hook'
- "gitleaks git --pre-commit --redact --staged --verbose"
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gitleaks hook description claims it scans commits, commit messages, and --no-ff merges, but the configured command runs only against staged content (--staged) during the pre-commit stage. Please update the description to match the actual behavior, or add an additional commit-msg stage hook to scan commit messages (and include commit-msg in default_stages if needed).

Copilot uses AI. Check for mistakes.
Comment thread .pre-commit-config.yaml
Comment on lines +28 to +29
entry: make
args: ["grype-scan-local"]
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grype-scan-local is invoked via entry: make/args: ["grype-scan-local"], but that target is not defined in this repo’s root Makefile (it will fall through to the %: rule and rely on /usr/local/share/eps/Mk/common.mk). This makes the pre-commit hook dependent on an external file that won’t exist for contributors not running inside the base devcontainer image. Consider defining grype-scan-local in the repo Makefile (or invoking grype directly) so the hook works in a standard checkout.

Suggested change
entry: make
args: ["grype-scan-local"]
entry: bash
args:
- -c
- |
if ! command -v grype > /dev/null 2>&1; then
echo "Error: grype is not installed or not available on PATH."
echo "Please install grype to run this pre-commit hook."
exit 1
fi
grype dir:.

Copilot uses AI. Check for mistakes.
Comment thread .pre-commit-config.yaml
Comment on lines +27 to +28
name: Grype scan local changes
entry: make
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook is named “Grype scan local changes”, but the underlying grype-scan-local target runs grype . (repo-wide scan) rather than scanning only staged/local changes. Either rename the hook to reflect the actual behavior or adjust the target so it only scans what changed.

Copilot generated this review using guidance from repository custom instructions.
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