Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

ci: harden dependabot workflows + switch CodeQL to advanced setup - #59

Merged
LiukScot merged 5 commits into
mainfrom
fix/dependabot-workflows-hardening
May 24, 2026
Merged

ci: harden dependabot workflows + switch CodeQL to advanced setup#59
LiukScot merged 5 commits into
mainfrom
fix/dependabot-workflows-hardening

Conversation

@LiukScot

Copy link
Copy Markdown
Owner

Summary

  • Hardens dependabot review workflows (claude-pr-review-dependabot.yml, dependabot-auto-merge.yml) per prior CodeRabbit pass.
  • Replaces CodeQL Default Setup with an advanced workflow (.github/workflows/codeql.yml) so the required check Analyze (javascript-typescript) is always posted on every PR — not skipped when a PR touches only YAML/MD (this was the root cause of chore(deps): bump actions/checkout from 4 to 6 #48 staying in "Expected — Waiting for status to be reported" forever).
  • Adds AGENTS.md §14 rule: every new test must run in CI, every new correctness-gating job must be added to main's required status checks in the same PR.

Why CodeQL change matters

GitHub's CodeQL Default Setup auto-skips analysis on PRs that touch only workflow YAML or markdown. Branch protection on main requires Analyze (javascript-typescript) → check stays pending → PR unmergeable. Advanced workflow runs unconditionally, status always posted.

Matrix [javascript-typescript, actions] covers the same surface as prior Default Setup (actions, javascript, javascript-typescript, typescript); javascript and typescript are deprecated aliases that resolve to javascript-typescript.

Operational prerequisite

Default Setup has already been disabled via API (PATCH /repos/.../code-scanning/default-setup state=not-configured) before merging, to prevent both setups racing on the same category.

Test plan

  • CI green on this PR (advanced CodeQL workflow runs and posts Analyze (javascript-typescript) + Analyze (actions))
  • After merge, verify a follow-up PR that touches only YAML still receives a posted CodeQL status (regression check for the original chore(deps): bump actions/checkout from 4 to 6 #48 issue)

🤖 Generated with Claude Code

LiukScot and others added 3 commits May 24, 2026 19:45
Prevents merging PRs that introduce correctness-gating jobs without
also enforcing them on main — a job not in required checks can be
skipped silently.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Default Setup auto-skips analysis on PRs that touch only workflow
YAML, markdown, etc. With "Analyze (javascript-typescript)" listed
as a required status check on main, those PRs got stuck in
"Expected — Waiting for status to be reported" forever (e.g. #48).

Advanced workflow runs on every PR with no paths-ignore, so the
status is always posted. Matrix covers javascript-typescript +
actions to match the prior default-setup language coverage.

Default Setup must be disabled in Settings → Code security → CodeQL
before this lands, otherwise jobs collide on the same category.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Address reviewer suggestions:
- codeql.yml: pin actions/checkout to SHA + version comment to
  match sibling workflows (claude-pr-review-dependabot.yml,
  dependabot-lockfile-sync.yml).
- AGENTS.md §14: close the new bullet with a period for
  consistency with siblings.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@LiukScot, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 43 minutes and 21 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9a187947-6d0a-43e9-9264-f22d7b967d83

📥 Commits

Reviewing files that changed from the base of the PR and between aad6637 and 460c5b6.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml
📝 Walkthrough

Walkthrough

This PR adds CodeQL security analysis to the repository with a new GitHub Actions workflow and documents updated CI governance rules. The workflow runs on main branch pushes, all pull requests, and a weekly schedule, scanning JavaScript/TypeScript and Actions code. The AGENTS.md update codifies that new tests must run in CI and correctness-gating CI jobs must be added to required status checks.

Changes

CI Security and Governance

Layer / File(s) Summary
CodeQL workflow implementation
.github/workflows/codeql.yml
New workflow defines CodeQL security analysis with multiple triggers (main pushes, PRs, weekly cron), scoped job permissions for security event reporting, concurrency controls per ref with cancellation, and language matrix coverage (javascript-typescript, actions).
CI governance rules documentation
AGENTS.md
Documents rule requiring newly added tests to execute in CI jobs and requiring new correctness-gating CI jobs to be added to main's required status checks within the same PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: hardening dependabot workflows and switching CodeQL to advanced setup, matching the primary objectives of the pull request.
Description check ✅ Passed The description is well-detailed and directly related to the changeset, explaining the rationale behind each modification and providing context for why the changes matter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/codeql.yml:
- Around line 33-38: Update the workflow to pin the CodeQL actions to immutable
commit SHAs and disable checkout credential persistence: replace the mutable
refs `github/codeql-action/init@v3` and `github/codeql-action/analyze@v3` with
their respective full commit SHA pins, and add `with: persist-credentials:
false` to the `uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd`
step so credentials are not persisted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f16d3f15-3ac1-43ae-a698-cc87c45dd04f

📥 Commits

Reviewing files that changed from the base of the PR and between a4d5f63 and aad6637.

📒 Files selected for processing (2)
  • .github/workflows/codeql.yml
  • AGENTS.md

Comment thread .github/workflows/codeql.yml
LiukScot and others added 2 commits May 24, 2026 19:59
Address CodeRabbit review on #59:
- Pin github/codeql-action/init + analyze to commit SHA
  (v3.36.0 = 03e4368) so workflow can't shift under us if the
  v3 tag is ever moved. Matches the SHA-pinning style used in
  sibling workflows (claude-pr-review-dependabot.yml).
- Add `persist-credentials: false` to actions/checkout. The
  CodeQL job has no need to push, so leaving the GITHUB_TOKEN
  in .git/config after checkout is unnecessary attack surface
  (artipacked / credential persistence).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AGENTS.md §14 policy: "Track third-party actions at their latest
stable tag. Pin to SHA only when an action's repo has had a
tag-moving incident." github/codeql-action is GitHub-owned and
has had no such incident, so the SHA pin in f02b9e0 violated
project policy. Revert to @V3.

persist-credentials: false on checkout is kept — that's a
separate security best practice unrelated to action versioning.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@LiukScot
LiukScot enabled auto-merge (squash) May 24, 2026 18:05
@LiukScot
LiukScot merged commit a7156be into main May 24, 2026
20 checks passed
@LiukScot
LiukScot deleted the fix/dependabot-workflows-hardening branch May 24, 2026 18:05
LiukScot added a commit that referenced this pull request May 25, 2026
## Summary

- Updates AGENTS.md §14: third-party GitHub Actions must be pinned to a
full commit SHA with `# vX.Y.Z` comment (Dependabot still bumps
SHA+comment together).
- GitHub-owned actions (\`actions/*\`, \`github/*\`) may keep tags; SHA
preferred for defense-in-depth.

## Why

Tag references can be silently rewritten by a compromised maintainer
account. SHA pins are immutable. Dependabot supports SHA bumps when a
\`# vX.Y.Z\` comment is present, so maintenance cost stays low.

This change also corrects a self-inflicted bug surfaced in #59: I'd
interpreted §14 as forbidding SHA pins on github-owned actions, which
led to a tag-revert commit. The new wording removes that ambiguity.

## Follow-up (not in this PR)

- Audit existing workflows and convert third-party tags to SHA pins.
- Verify \`.github/dependabot.yml\` includes the \`github-actions\`
ecosystem.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant