-
Notifications
You must be signed in to change notification settings - Fork 30
Add pre-commit config for repo hygiene and secret detection #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Pre-commit hooks for usernaut (whole repo). | ||
| # | ||
| # Install: pip install pre-commit && pre-commit install | ||
| # Run manually: pre-commit run --all-files | ||
|
|
||
| exclude: ^vendor/ | ||
|
|
||
| repos: | ||
| # Generic file and repo hygiene (pre-commit/pre-commit-hooks) | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| exclude: ^CODEOWNERS$ # script + CI validate; avoid pre-commit changing trailing newlines | ||
| - id: check-yaml | ||
| args: [--allow-multiple-documents] | ||
| - id: detect-private-key | ||
| - id: check-merge-conflict | ||
|
|
||
| # Secret detection (requires Go >= 1.23.8; run: brew upgrade go) | ||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.28.0 | ||
| hooks: | ||
| - id: gitleaks | ||
|
Comment on lines
+21
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Security & Privacy | π Major | β‘ Quick win π§© Analysis chainπ Script executed: #!/usr/bin/env bash
set -euo pipefail
curl -fsSL \
https://raw.githubusercontent.com/gitleaks/gitleaks/v8.28.0/.pre-commit-hooks.yaml |
grep -A8 'id: gitleaks'Repository: redhat-data-and-ai/usernaut Length of output: 800 π Script executed: #!/usr/bin/env bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
p = Path(".pre-commit-config.yaml")
print("exists:", p.exists())
if p.exists():
lines = p.read_text(encoding="utf-8").splitlines()
for i, line in enumerate(lines, start=1):
if 19 <= i <= 30:
print(f"{i:4}: {line}")
PYRepository: redhat-data-and-ai/usernaut Length of output: 503 Provide a full-repository Gitleaks scan path. The Gitleaks pre-commit hook runs π€ Prompt for AI AgentsSource: Path instructions |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ποΈ Data Integrity & Integration | π Major | β‘ Quick win
π§© Analysis chain
π Script executed:
Repository: redhat-data-and-ai/usernaut
Length of output: 15586
Preserve the existing project checks.
.pre-commit.config.yamlinstalls hooks viapre-commit install, butMakefileinstalls.git/hooks/pre-commitfromscripts/pre-commit, which runsscripts/check-secrets.shandmake lint test. Thatmake lint teststep is not replaced by the added pre-commit hooks. Add an equivalent local hook, or make the legacy hook chain both pre-commit and the project checks.π€ Prompt for AI Agents
Source: Path instructions