Skip to content

ci: replace gitleaks action with pinned, verified CLI in secret-scan - #680

Open
don-petry wants to merge 18 commits into
mainfrom
dev-lead/issue-679-20261109-1654
Open

don-petry wants to merge 18 commits into
mainfrom
dev-lead/issue-679-20261109-1654

Conversation

@don-petry

@don-petry don-petry commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

User description

Problem

[Fleet Monitor] combsmith/google-app-scripts — .github/workflows/ci.yml

From the issue: | Metric | Value | |---|---| | Failure Rate | 16.7% (1 / 6 runs) | | Status | WARNING | | p50 Duration | 254s | | p95 Duration | 555s | | Successful Runs | 5 | | Cancelled Runs | 0 |

Risk

Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.

Test plan

Tests added/updated: scripts/tests/ci-workflow.test.js. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.

Closes #679

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • Chores
    • Updated automated secret scanning to use a checksum-verified scanner. Scans redact detected secrets, cover the full repository history, and fail when findings are present. The scanning job uses read-only repository access.
  • Tests
    • Automated checks now run the project’s test suite.
    • Added checks for scanner verification, full-history scan coverage, redaction, failure behavior, and workflow permissions.

CodeAnt-AI Description

Allow secret scans to run on Dependabot pull requests

What Changed

  • Replaced the license-dependent scan action with a pinned gitleaks release verified before installation, so scans do not rely on Actions secrets.
  • The scan still checks full repository history, fails when it finds secrets, and redacts findings.
  • Removed the scan’s unnecessary security-events write permission.

Impact

✅ Dependabot pull requests can run the required secret scan
✅ Secret scanning no longer requires a Gitleaks license secret
✅ Secret findings remain fully redacted

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@don-petry
don-petry requested a review from a team as a code owner November 9, 2026 16:57
@don-petry don-petry added the auto-rebase:ready Opts a non-draft PR into auto-rebase without an approval (auto-rebase ready_label) label Nov 9, 2026
@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #680
No changes were committed, but the PR still can't be marked done: required check SonarCloud is still pending. The retry cron will re-attempt automatically. Next attempt after: 2026-11-09T17:28:14Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required check SonarCloud is still pending. I'll re-check automatically.
Next attempt after: 2026-11-09T17:28:14Z

@don-petry
don-petry enabled auto-merge (squash) November 9, 2026 16:58
@don-petry

Copy link
Copy Markdown
Collaborator Author

QA Lead — test-risk advisory

Risk tier: LOW. This change only touches CI. It swaps the license-gated gitleaks action for the gitleaks command-line tool, pinned and checksum-verified. The "Secret scan (gitleaks)" check is already green on this PR, and reverting is trivial.

What I'd shore up (highest leverage first):

  • Prove the scanner still catches a secret. The new tests in scripts/tests/ci-workflow.test.js only text-match the YAML. They show the config has the right shape, not that the scan works. If a later edit drops --exit-code 1 or the scan finds nothing to check, the gate passes silently. Add a small test that runs the same gitleaks detect command on a temporary repo with a planted fake secret and expects it to fail.
  • Confirm the root cause. Link the one failed run (1 of 6) and show it was the missing-license failure on a Dependabot run. Otherwise this may fix a different failure and the monitor warning will stay. The slow p95 (555s) probably comes from another job, so this PR won't move it.
  • Run the fix on a Dependabot PR once. Checking a Dependabot-triggered run after merge is what actually closes [Fleet Monitor] combsmith/google-app-scripts — .github/workflows/ci.yml #679.
  • Correct the PR body. It says "the bats suite runs in CI", but the new test is a Jest test run by npm test.

Escalate? no

Advisory only — I comment, I do not change code. Ground: BMAD Test Architecture
(bmad-tea v1.19.0). Opt out on this item with the qa-lead:hands-off label.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-11-09T18:00:36Z.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry
don-petry disabled auto-merge November 9, 2026 20:52
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@donpetry-bot

donpetry-bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge November 9, 2026 22:33
@don-petry

Copy link
Copy Markdown
Collaborator Author

Codex review failed to complete. No specific findings are listed in this comment—this appears to be an operational notice rather than actionable code issues. The bot can be retried with @codex review if needed. Since all CI checks are passing and the review body contains no concrete findings, no code changes are required at this time.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
## Summary
**Bot:** chatgpt-codex-connector[bot]  
**Issue type:** Operational notice (incomplete review)  
**Action taken:** Disposition posted
The Codex bot comment reported a failed review with metadata indicating `"has_any_findings":true`, but the actual comment body contains no specific findings—only an operational error message: "We couldn't complete this review. Comment `@codex review` to try again."
Since the comment lists no actionable code issues and all CI checks are passing (Node.js Tests, SonarCloud, CodeQL, etc.), this is an **informational operational notice**, not a code finding. I posted an `informational` disposition on the original comment (ID: `IC_kwDORFz9wc8AAAABkhjhFg`), which clears the maintainer-comment gate blocker while documenting that the review could not be completed and no code changes are required.
**Files changed:** None  
**Disposition:** `informational` — operational notice with no actionable findings [replied on PR #680](https://github.com/combsmith/google-app-scripts/pull/680#issuecomment-6753292790)

@don-petry
don-petry enabled auto-merge (squash) November 9, 2026 22:34
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@donpetry-bot

donpetry-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge November 10, 2026 02:28
@don-petry
don-petry enabled auto-merge (squash) November 10, 2026 02:29
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-11-10T07:03:22Z.

@don-petry

Copy link
Copy Markdown
Collaborator Author

CodeRabbit's rate-limit notice is an operational status update indicating review throttling due to Fair Usage Limits, not an actionable code finding. The prior CodeRabbit review findings regarding gitleaks redaction verification have been addressed in the test file (lines 76–79 and 91–94 verify full redaction and the absence of weakening flags), and all CI checks pass.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
- The test file already contains comprehensive verification checks:
  - Lines 76–79: Check exact one `--redact` flag that's either bare or `=100`, and verify `--redact=0` is absent
  - Lines 91–94: Identical comprehensive checks in the dedicated redaction test
**Disposition Reply Posted:**
- Explained that the rate-limit notice is operational, not a finding
- Referenced the existing redaction checks in the test file (lines 76–79, 91–94)
- Confirmed all CI checks pass
**Files Checked:**
- `scripts/tests/ci-workflow.test.js` — already contains the required redaction verification
All active CI checks pass (`success` or `skipped`), and the prior CodeRabbit finding has been addressed by the existing codebase.

@don-petry

don-petry commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry

This comment has been minimized.

@donpetry-bot

donpetry-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@don-petry

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
1. **Earlier CodeRabbit nitpick** (Nov 11): CodeRabbit found an issue at line 69 about insufficient gitleaks redaction verification
2. **Fix applied**: Developers strengthened the test with additional redaction verification checks (commits "fix(bot): strengthen gitleaks redaction verification in test")
3. **Latest CodeRabbit review** (Nov 13): CodeRabbit re-reviewed the code and reported: "**No actionable comments were generated in the recent review**"
4. **"Review triggered" comment**: This is just an operational notice about CodeRabbit being triggered to review
I've already dispositioned the "Review triggered" operational notice as `informational`, which clears the maintainer-comment gate since it carries no code findings.
**Bot: coderabbitai[bot]**  
**Issues addressed: 1**
- Review triggered (operational notice): Dispositioned as `informational` — no code changes needed [disposition=informational]
**Files changed:** None (all fixes were in prior commits)  
**Status:** ✓ Complete — latest CodeRabbit review confirms all nitpick findings have been addressed and no new issues were detected.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Acknowledged: the current body of this CodeRabbit comment is only an 'Action performed / Review finished' notice from a review command. It has no findings, no actionable, outside-diff or nitpick items, and no architecture section, so no action is needed.

@don-petry

don-petry commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

No description provided.

The first test 'runs gitleaks detect over full history and fails on findings'
was checking both full-history/exit-code behavior AND detailed redaction
verification. The detailed redaction checks are now the exclusive responsibility
of the dedicated second test 'runs gitleaks with full redaction that cannot be
weakened', reducing duplication and making each test's purpose clearer.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@don-petry

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@donpetry-bot

donpetry-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Updated PR title from 'feat: implement issue #679 — [Fleet Monitor] combsmith/google-app-scripts — .github/workflows/ci.yml' to 'ci: replace gitleaks action with pinned, verified CLI in secret-scan' to address the CodeRabbit pre-merge check finding. The title now clearly states the main change without tracker labels or file paths, as recommended.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
## Summary
**Bot:** coderabbitai[bot]
**Issues addressed:** 1
- **PR title check (inconclusive):** The PR title was not descriptive of the actual change. Updated from `feat: implement issue #679 — [Fleet Monitor] combsmith/google-app-scripts — .github/workflows/ci.yml` to `ci: replace gitleaks action with pinned, verified CLI in secret-scan` to clearly state the main change without tracker labels or file paths. [disposition=answered]
**Stale dispositions handled:** 3
- `IC_kwDORFz9wc8AAAABkhjyRw` (coderabbitai): Posted fresh disposition reply after addressing the title check finding
- `IC_kwDORFz9wc8AAAABlGtrsg` (codeant-ai): Clean status re-post ("Review completed") — auto-cleared pattern, no action needed
- `IC_kwDORFz9wc8AAAABlGxIyg` (codeant-ai): Clean status re-post ("Low Risk") — auto-cleared pattern, no action needed
**Files changed:** None (PR metadata only)
**Notes:** All CI checks are passing. The PR is ready for merge once the gate clears the disposition replies.

@donpetry-bot

donpetry-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Re-read the current body of this CodeAnt review-status comment (edited after my earlier disposition). It only lists completed incremental reviews, the latest on aa405d9. It contains no findings and needs no action.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Re-read the current body of this CodeAnt PR Risk comment (edited after my earlier disposition). It rates the PR Low Risk at aa405d9 and raises no findings, so no action is needed.

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: aa405d95fd28e00a2679b76b4bb4a6996a5abef9
Review mode: triage-approved (single reviewer)

Summary

The secret-scan job in .github/workflows/ci.yml now uses the gitleaks CLI (v8.30.1) instead of gitleaks/gitleaks-action. The CLI is downloaded from the official GitHub release, checked with sha256sum -c against a pinned checksum, and then installed. The job no longer reads GITLEAKS_LICENSE or GITHUB_TOKEN, so it can run on Dependabot-triggered PRs, which get no Actions secrets. security-events: write is removed because nothing uploads SARIF. The job keeps contents: read. The scan command is unchanged: detect --source . --redact --verbose --exit-code 1, with fetch-depth: 0. The new file scripts/tests/ci-workflow.test.js checks the job's structure: job name, no action or license secret, pinned version and checksum, full history, exit code, full redaction and permissions.

I raised the risk from triage's LOW to MEDIUM. The change only touches CI and is easy to revert, but it changes how a required security gate works. That gate now runs a downloaded binary instead of a pinned action. None of the HIGH triggers apply. The PR removes a secret dependency and handles no secrets. The safety checks report no CI weakening and no secret in a run: step. No third-party reusable workflow is added.

Linked issue analysis

#679 is a Fleet Monitor warning: ci.yml failed 1 of 6 runs (16.7%). The issue has no acceptance criteria and is already CLOSED, so Closes #679 does nothing. The PR says the failure came from gitleaks-action needing a license secret on Dependabot runs. That is a plausible cause, and the fix addresses it directly. Unconfirmed: the issue does not link the failed run, and I had no access to the run logs, so I could not check that this was the failure. The QA-lead advisory raised the same point. Someone should confirm the fix on the next Dependabot PR. The p95 duration in the issue (555s) almost certainly comes from another job and won't change with this PR.

Findings

No blocking findings.

Verified from the diff and checks:

  • The install fails safely. GitHub's default bash -e shell stops the step if wget, sha256sum -c, tar or mv fails, so an unverified binary never runs. tar extracts only the gitleaks binary.
  • The checksum matches the real release. The Secret scan (gitleaks) check passed on this head SHA, and sha256sum -c runs inside it. That success implies the pinned checksum matched the downloaded archive. I could not compare it against upstream's published checksums.txt myself.
  • Least privilege improves. Write permission is removed and no secrets are used.
  • The test helper is robust. extractJob accepts quoted job keys and inline comments, and ignores column-0 comments, which resolves the Gemini robustness feedback. The redaction test requires exactly one bare --redact or --redact=100, which resolves the Cubic P2 and CodeRabbit nitpick. The GITLEAKS_LICENSE and secrets. assertions apply only to the job's own lines, so the header comment that mentions GITLEAKS_LICENSE does not trip them.
  • The new test runs in CI. CodeRabbit's unverified note was that ci.yml never runs npm test. The separate Node.js Tests workflow runs the Jest suite and passed on this SHA.

Non-blocking notes:

  1. Wider scan scope. On pull_request events, gitleaks-action scanned only the PR's commit range. The CLI scans the whole repository history on every run. That is stricter and passes today, but a secret already in history will now fail every PR until it is allowlisted or removed.
  2. Deprecated subcommand. gitleaks detect is deprecated in recent 8.x releases in favour of gitleaks git. It still works in 8.30.1. Consider switching when the version is next bumped.
  3. The tests only check the YAML text. They confirm the job is configured correctly but not that the scan catches anything. As the QA lead suggested, a later improvement could run the same command against a temporary repo with a planted fake secret.
  4. The PR body is slightly wrong. It says "the bats suite runs in CI", but the new test is a Jest test.
  5. Org standard not checked. The job comment points to the org-canonical job in combsmith/.github standards/workflows/ci.yml. That file is not in this review's context, so I could not confirm the job matches it.

Not checked (no access): the MCP run_secret_scanning tool was not available, so no GitHub secret scan ran on the diff. The diff adds only a public release checksum and a version string, no credentials. I could not read review-thread resolution state from the pre-fed data. Cubic's latest review says all its reported issues were addressed, and no reviewer has requested changes.

CI status

All quality checks passed on aa405d9:

  • CI: Secret scan (gitleaks), build-and-test and autofix
  • Tests and coverage: Node.js Tests, coverage and Playwright UI Tests
  • CodeQL: actions, javascript-typescript and python
  • SonarCloud: quality gate passed, with 0 new issues and 0 hotspots
  • Dependency audit: gate passed
  • Agent and review checks: AgentShield, cubic and pr-auto-review

dev-lead / dispatch, dev-lead / ci-relay and dev-lead / resume were CANCELLED. These are agent-orchestration jobs that a newer run superseded, not quality gates. The skipped checks (Dependabot auto-merge, the non-npm ecosystem audits, CodeRabbit) are skipped because they don't apply to this PR. The merge state is BLOCKED only because the org-leads approval is still required.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

@donpetry-bot

Copy link
Copy Markdown
Contributor

pr-review approved on PARTIAL advisory evidence: 4/5 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596).

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — rate-limited (intent: fix-reviews)

PR: #680
The retry cron will re-attempt automatically.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-rebase:ready Opts a non-draft PR into auto-rebase without an approval (auto-rebase ready_label) size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet Monitor] combsmith/google-app-scripts — .github/workflows/ci.yml

2 participants