Repository navigation
chore(security): drop inert .gitleaksignore and detect-private-key exclusions - #1311
Conversation
…clusions .gitleaksignore held a single bare path, which gitleaks does not accept as an ignore entry (it expects finding fingerprints), and no workflow, hook, Makefile target or script in this repo has ever run gitleaks. The file suppressed nothing while reading as an active suppression. git-secrets is the secret gate, and its --register-aws allow-list already covers the AWS documentation example keys in internal/secrets/aws_resolver_httptest_test.go. The detect-private-key hook excluded every _test.go file and frontend/src/index.html. No tracked file contains a private-key header, so both exclusions exempted nothing while letting a key pasted into any Go test fixture past the gate. Remove them. Closes LeanerCloud#299 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in main's CI fixes (LeanerCloud#1236, LeanerCloud#1252) and CI changes since, so this PR gets a fresh CI run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Non-blocking:
Attacked:
Body-stale:
Reviewer: rB6. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Local verification at |
|
Merged by IAmJSD's agent at IAmJSD's request (IAmJSD is acting owner while the maintainers are away), under the bar IAmJSD set: 1 approving independent review(s) on |
Root cause
.gitleaksignoredoesn't do anything. It holds one bare path,internal/secrets/aws_resolver_httptest_test.go, under two comment lines. gitleaks expects finding fingerprints and rejects a bare path as an invalid entry. More to the point, nothing in this repo has ever run gitleaks: no workflow, pre-commit hook, Makefile target or script.git grep -i gitleaksfinds only a runbook to-do (.github/runbooks/credential-compromise.md:128) and the 2026-09-02 audit, andgit log --all -S gitleaksfinds only the commits that added those two documents. So the file suppresses nothing, yet reads as if it did. The issue counted two stale entries; on main there is one.scripts/setup-git-secrets.shcallsgit secrets --register-aws. The built-in allow-list of that command already covers the AWS documentation example keys (AKIAIOSFODNN7EXAMPLE/wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY) in that test file. Deleting.gitleaksignoretherefore changes no scan result.detect-private-keyexclusions in.pre-commit-config.yamlcovered nothing real. The hook excluded(_test\.go|frontend/src/index\.html)$, but no tracked file contains a private-key header. The exclusions exempted no existing file and would have let a key pasted into any Go test fixture through (audit A14-036).Fix
.gitleaksignore. The issue's acceptance criteria name this as the option when gitleaks isn't adopted.exclude:from thedetect-private-keyhook, and replace the outdated comment with one that explains why there is no exclusion. It also says what a future test should do: build the PEM at runtime, asscripts/test-git-secrets-allowlist.shalready does, or add a narrow per-file exclude with a written reason.No Go code, workflow or
frontend/file is touched. Removing thefrontend/src/index.htmlpattern changes only the config file.Closes #299
Verification
This is config and fixture evidence only. No Go code changed, so there are no Go tests.
pre-commit-hooksv6.0.0:mktemp -dgit repo, deleted afterwards. The fixture isinternal/x/fixture_test.go, which contains a-----BEGIN PRIVATE KEY-----block. I ranpre-commit run detect-private-key --all-filesagainst the real config files:.pre-commit-config.yaml(git show HEAD:.pre-commit-config.yaml):Passed, exit 0. The key in the test file got through..pre-commit-config.yaml:FailedwithPrivate key found: internal/x/fixture_test.go, exit 1.git ls-files -z | xargs -0 grep -lE 'BEGIN (RSA |DSA |EC |OPENSSH |PGP |ENCRYPTED )?PRIVATE KEY|PuTTY-User-Key-File-2|BEGIN OpenVPN Static key V1'printed nothing.bash scripts/test-git-secrets-allowlist.sh:137 PASS, 0 FAIL, exit 0. I ran it with two git-secrets builds:GIT_SECRETS_SHAad82d68ee924906a0401dfd48de5057731a9bc84frompre-commit.yml;7d6b970c.git grep -n -F gitleaksignore -- ':!docs/audits'finds nothing, so no script, test or workflow reads the file.pre-commit run check-yaml --files .pre-commit-config.yamlandpre-commit run trailing-whitespace --files .pre-commit-config.yamlboth passed.Gaps: the full
pre-commit run --all-filesand the CI workflows were not run on this branch.Combined-tree verification. This branch was tested together with the other queued branches on a local, never-pushed tree:
queue/platform@b56afb2b= origin/maina14dc8f2plus these heads, merged in this order:fix/issue-324andfix/issue-204both edit.github/workflows/ci.ymlnext to theazure-kv-access-policyjob. The tree kept #324's new "Run Function URL reader self-tests" step and #204's updated job comment; whichever PR merges second takes that same resolution.Linux, Go 1.26.9,
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/null AWS_EC2_METADATA_DISABLED=true; Docker Postgres via testcontainers. The full suite ran oned0c7174, which differs fromb56afb2bonly by one.gitallowedline on fix/issue-324:go build ./...,go vet ./...,go vet -tags integration ./...and the fullgo test -race -short -count=1 ./....--build-tags integration.gocyclo -over 10is silent on the changed non-test files.-tags integration -count=1, 60-minute local timeout):internal/api,internal/purchase,internal/schedulerandinternal/serverall pass..gitallowedline. Re-run atb56afb2b: git-secrets, using the repo'sscripts/setup-git-secrets.shpatterns in a fresh repo with an isolated HOME, found nothing in the changed files, and a planted fake key was flagged.scripts/test-git-secrets-allowlist.sh: 137 PASS, 0 FAIL.Review manually / alternatives
.github/workflows/pre-commit.ymland a pre-commit hook. Then rebuild.gitleaksignorefromgitleaks detect --report-format jsonfingerprints, or use a.gitleaks.tomlallowlist for the AWS example keys. It would add a second secret scanner next to git-secrets, so it's a policy call. This PR takes the "delete the inert file" option from the issue's acceptance criteria instead._test.goexclusion means a future PEM test fixture needs a per-file exclusion, or must build the PEM at runtime asscripts/test-git-secrets-allowlist.shdoes. Today no tracked file needs one, as verified above..gitleaksignoreentries; on main there is one bare-path line under two comment lines.Out of scope
docs/audits/codebase-audit-2026-09-02.mdstill mentions.gitleaksignore: in A14-036, and at line 10351, which lists it among scanner suppression files that "carry per-entry written justifications". The audit is a dated record, so I left it alone..github/runbooks/credential-compromise.md:128) is unchanged. It belongs with the adopt-gitleaks decision above.Maintainer: please mirror the issue's triage labels onto this PR:
bug,impact/internal,type/chore,triaged,priority/p3,severity/low,urgency/eventually,effort/xs.🤖 Generated with Claude Code