Repository navigation
Description
Problem or Motivation
No secret scanner stops a commit, a push or a merge.
.pre-commit-config.yamlhas onlydetect-private-key.grep -n -i -E "gitleaks|trufflehog|detect-secrets" .github/workflows/*.ymlfinds only the tool install ofcopilot-setup-steps.yml.- The CI step
Security Scanofci.ymlwrites a SARIF report and sets no failure threshold. - GitHub secret scanning with push protection is on, but it covers provider patterns only:
secret_scanning_non_provider_patternsisdisabled(read from the repository settings on 2026-11-25).
So a generic password, a token of an internal service or a key of an unlisted provider can reach a public repository. The repository already has a gitleaks scanner in devops scan (tests/security/test_security_gitleaks.py), but no hook and no workflow runs it.
Found by the workflow gap analysis of 2026-11-25.
Proposed Solution
Disposition: change the configuration.
- Add the
gitleakshook of the gitleaks project to.pre-commit-config.yaml(pre-commit stage). - Run gitleaks on the pull request range in the job
Static Analysisand fail on a finding. - A person can also turn on the non-provider patterns in the repository settings.
Proof: a commit with a test token in a scratch branch fails the hook, and uv run devops ci --check --only actionlint,zizmor passes.
Existing Tool Considered
gitleaks (MIT), with its own pre-commit hook. No new code.
Alternatives check of 2026-11-25: in-use.
The repository already uses this tool.
Tool: gitleaks/gitleaks (https://github.com/gitleaks/gitleaks), MIT, last activity 2026-11-25, maintained.
Reason: Searches found gitleaks as the maintained MIT scanner with its own pre-commit hook and a CLI for a pull-request range; the issue already names it as the scanner in devops scan, and it covers the hook and CI need.
Covers:
- Pre-commit hook that fails a commit with a secret
- CLI scan of a commit or pull request range
- Configurable rules for generic passwords and internal tokens
Lacks:
- GitHub non-provider patterns still need a person to enable
- Needs a gitleaks config and a step in
Static Analysis - Scans no history until someone runs it on old commits
Proposed design
Problem statement
No secret scanner stops a commit, a push or a merge. The repository holds a gitleaks scanner in devops scan, but no hook and no workflow runs it. A generic password, a token of an internal service or a key of an unlisted provider can reach a public repository.
Acceptance criteria
Requirement: Gitleaks hook on commit
The repository MUST run the gitleaks scanner at the pre-commit stage of each commit.
Scenario: A staged test token stops the commit
- WHEN A person stages a file that holds a test token and runs
pre-commit run gitleaks - THEN The hook exits 1 and prints the gitleaks rule ID of the match.
Requirement: Gitleaks configuration accepts the test fixtures
The repository SHALL hold a .gitleaks.toml that extends the default rules and allowlists the paths of the test fixtures.
Scenario: A staged fake GitHub token in a test passes the hook
- WHEN A person stages a new line with
ghp_1234567890abcdefghijklmnopqrstuvwxyzintests/security/test_security_gitleaks.pyand runspre-commit run gitleaks - THEN The hook exits 0 and prints
no leaks found.
Requirement: Gitleaks scans the pull request range in CI
The Static Analysis job MUST install gitleaks and run it on the commits of the pull request range, and MUST fail on a finding.
Scenario: A test token in a scratch pull request fails the job
- WHEN A person pushes a scratch branch with a test token and opens a draft pull request
- THEN The gitleaks step exits 1 and the
Static Analysisjob reports a failure.
Requirement: The workflow files pass the workflow checks
The changed workflow file MUST pass the workflow checks of the repository.
Scenario: The workflow checks pass
- WHEN A person runs
uv run devops ci --check --only actionlint,zizmor - THEN The command exits 0 and reports no finding.
Requirement: Pending a person after the merge
A person MUST enable secret scanning non-provider patterns for the repository after the merge.
Scenario: The repository reports the non-provider patterns enabled
- WHEN A person runs
uv run devops gh api repos/dan-petty/devops-cli --jq '.security_and_analysis.secret_scanning_non_provider_patterns.status' - THEN The command prints
enabled.
Existing Tool Considered
gitleaks (https://github.com/gitleaks/gitleaks), MIT, verdict in-use: the repository already runs it in devops scan. The alternatives check in the issue body states what the tool covers and lacks. The proposal supplies what the tool lacks: a .gitleaks.toml that allowlists the test fixtures, and a step in the Static Analysis job that installs gitleaks and scans the pull request range. The change builds no code of its own.
Key questions
- Which form of the gitleaks hook goes into
.pre-commit-config.yaml?: A local hook withlanguage: systemrunsgitleaks git --pre-commit --redact --staged --verbose --config .gitleaks.toml. The devtools image ships the gitleaks binary and each local hook of this file useslanguage: system. (best practice) [sources: .pre-commit-config.yaml]- Chosen: local hook with language system. The devtools image copies the gitleaks binary to /usr/local/bin and the local hooks of this file run system commands, so no hook environment is built.
- Rejected: upstream hook repository with language golang. pre-commit builds the tool with the Go toolchain at install time in each environment, while the image already holds the binary.
- How does the hook accept the test fixtures that hold fake tokens?: Add
.gitleaks.tomlthat extends the default rules and allowlists the paths of the test fixtures. The hook and the CI step pass--config .gitleaks.toml. (best practice) [sources: tests/security/test_security_gitleaks.py, .pre-commit-config.yaml]- Chosen: .gitleaks.toml with a path allowlist. The config holds the allowlist for the fixture paths, and one file serves the hook and the CI step.
- Rejected: .gitleaksignore with fingerprints. A fingerprint changes when the line changes, so the allowlist stops working after an edit.
- Rejected: exclude the paths in the hook arguments. The gitleaks command has no path exclude for the staged scan, so the config holds the allowlist.
- Where does the CI scan run, and how does it get the gitleaks binary?: Add a step to the
Static Analysisjob of.github/workflows/ci.yml. The step installs gitleaks with the tool install of.github/workflows/copilot-setup-steps.ymlline 71 and runsgitleaks giton the range from the base branch to HEAD. (best practice) [sources: .github/workflows/ci.yml, .github/workflows/copilot-setup-steps.yml:71]- Chosen: step in the Static Analysis job. The job already runs the
devops cirows and is a required check, so a finding stops the merge (ADR 0004). - Rejected: step in the Security Scan step. That step uploads a SARIF report and sets no failure threshold, so a finding does not stop the merge.
- Rejected: a new workflow. A second workflow adds a required check to configure and repeats the setup of the static analysis job.
- Chosen: step in the Static Analysis job. The job already runs the
- Does the hook scan the staged index or the working tree?: The hook scans the staged index with
--staged. It judges the commit only and ignores the untracked scratch files under.data/agent/. (best practice) [sources: .pre-commit-config.yaml, AGENTS.md]- Chosen: staged index. The hook judges what the commit adds, and it skips untracked scratch files.
- Rejected: working tree scan. It reads the untracked files of
.data/agent/and each gitignored file, so a scratch secret stops an unrelated commit.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 25, 2026
Both add checks to the CI Static Analysis job, but #4779 runs hygiene hooks while the candidate adds gitleaks secret scanning.devops-cli-service commentedon Nov 25, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (4)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
chore(main): release 0.246.0 (#7697)
devops-cli-service commentedon Nov 29, 2026
Released in v0.246.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.246.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 11:55 UTC