Skip to content

Move dependency audit jobs to a separate scheduled workflow - #350

Merged
bubacoder merged 1 commit into
mainfrom
feature/audit
Jun 20, 2026
Merged

Move dependency audit jobs to a separate scheduled workflow#350
bubacoder merged 1 commit into
mainfrom
feature/audit

Conversation

@bubacoder

@bubacoder bubacoder commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Release Notes

  • Chores
    • Implemented automated daily security vulnerability audits with automatic dependency updates when vulnerabilities are detected.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@bubacoder, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 27 minutes and 39 seconds. Learn how PR review limits work.

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

⌛ How to resolve this issue?

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

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9841c668-d133-4b91-a067-ca1806d921ac

📥 Commits

Reviewing files that changed from the base of the PR and between 63cb37e and c27f104.

⛔ Files ignored due to path filters (1)
  • scripts/infra-mcp/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .github/workflows/dependency-audit.yml
  • .github/workflows/pre-commit.yml

Walkthrough

The two dependency-audit jobs (audit-scripts and audit-infra-mcp) are removed from .github/workflows/pre-commit.yml and consolidated into a new .github/workflows/dependency-audit.yml workflow. The new workflow runs on a daily cron schedule and manual dispatch, with contents: write permission, and adds auto-fix and commit-back behavior absent from the original jobs.

Changes

Dependency Audit Workflow Extraction

Layer / File(s) Summary
Remove audit jobs from pre-commit workflow
.github/workflows/pre-commit.yml
Removes the audit-scripts and audit-infra-mcp job definitions from the pre-commit workflow, leaving only the check job.
New workflow: triggers, permissions, and setup
.github/workflows/dependency-audit.yml
Adds the dependency-audit workflow triggered on daily cron and workflow_dispatch, with contents: write permission and setup steps for checkout, uv, and git author identity.
Audit and auto-fix logic for both dependency targets
.github/workflows/dependency-audit.yml
Implements pip-audit with conditional --fix for scripts/requirements.txt, an analogous uv export + conditional uv lock --upgrade flow for scripts/infra-mcp, and a final step that commits and pushes updated requirements.txt and uv.lock only when the working tree has diffs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • bubacoder/infra#337: Introduced the original GitHub Actions workflows running pip-audit against scripts/requirements.txt, which this PR now extends with auto-fix and scheduling.
  • bubacoder/infra#341: Made prior edits to pre-commit.yml adding conditional pip-audit failure-hint steps and re-run commands for the same audit jobs that this PR removes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: moving dependency audit jobs from pre-commit.yml to a new separate scheduled workflow (dependency-audit.yml).
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/audit

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
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/dependency-audit.yml (2)

8-10: ⚡ Quick win

Add workflow concurrency to prevent push races.

Manual dispatch and the scheduled run can overlap and race on git push, producing avoidable non-fast-forward failures.

Suggested concurrency guard
 jobs:
   audit-and-fix:
+    concurrency:
+      group: dependency-audit-${{ github.ref }}
+      cancel-in-progress: false
     runs-on: ubuntu-latest
🤖 Prompt for 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.

In @.github/workflows/dependency-audit.yml around lines 8 - 10, The workflow
lacks concurrency control which allows manual dispatch and scheduled runs to
overlap and attempt simultaneous git pushes, causing race conditions. Add a
concurrency configuration at the workflow level (typically after the on trigger
section and before the jobs section) that groups concurrent runs by a stable
identifier (such as the workflow name or a fixed string) and sets
cancel-in-progress to true to cancel any previously running instances when a new
run is triggered. This ensures only one instance of the audit-and-fix job runs
at a time.

28-29: ⚡ Quick win

Pin pip-audit to a fixed version for deterministic scheduled runs.

These lines use pipx run pip-audit without a version spec, so behavior can change unexpectedly when upstream releases. Pinning avoids surprise failures/churn in automated commits.

Suggested determinism diff
   audit-and-fix:
     runs-on: ubuntu-latest
+    env:
+      PIP_AUDIT_SPEC: "pip-audit==<pin-version>"
@@
-        run: pipx run pip-audit -r scripts/requirements.txt
+        run: pipx run --spec "$PIP_AUDIT_SPEC" pip-audit -r scripts/requirements.txt
@@
-        run: pipx run pip-audit -r scripts/requirements.txt --fix
+        run: pipx run --spec "$PIP_AUDIT_SPEC" pip-audit -r scripts/requirements.txt --fix
@@
-          pipx run pip-audit -r /tmp/infra-mcp-reqs.txt
+          pipx run --spec "$PIP_AUDIT_SPEC" pip-audit -r /tmp/infra-mcp-reqs.txt
@@
-          pipx run pip-audit -r /tmp/infra-mcp-reqs.txt
+          pipx run --spec "$PIP_AUDIT_SPEC" pip-audit -r /tmp/infra-mcp-reqs.txt

Also applies to: 32-33, 42-43, 52-53

🤖 Prompt for 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.

In @.github/workflows/dependency-audit.yml around lines 28 - 29, The `pipx run
pip-audit` command lacks a version pin, causing non-deterministic behavior when
upstream releases new versions. Pin the pip-audit tool to a specific version by
modifying each occurrence of `pipx run pip-audit` in the workflow (appearing on
lines 28-29, 32-33, 42-43, and 52-53) to include an explicit version constraint,
ensuring consistent and deterministic behavior across scheduled runs.
🤖 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/dependency-audit.yml:
- Around line 14-15: The actions/checkout@v6 action is configured with default
credential persistence enabled, which creates a push-capable GITHUB_TOKEN in git
config for all subsequent steps, unnecessarily exposing credentials if any step
is compromised. Add the persist-credentials: false parameter to the checkout
action configuration to disable credential persistence. This security hardening
should be applied to all instances of the checkout action in the workflow
(including the ones referenced at lines 55-63), and authentication should be
provided explicitly at push time only when needed via GITHUB_TOKEN environment
variable.

---

Nitpick comments:
In @.github/workflows/dependency-audit.yml:
- Around line 8-10: The workflow lacks concurrency control which allows manual
dispatch and scheduled runs to overlap and attempt simultaneous git pushes,
causing race conditions. Add a concurrency configuration at the workflow level
(typically after the on trigger section and before the jobs section) that groups
concurrent runs by a stable identifier (such as the workflow name or a fixed
string) and sets cancel-in-progress to true to cancel any previously running
instances when a new run is triggered. This ensures only one instance of the
audit-and-fix job runs at a time.
- Around line 28-29: The `pipx run pip-audit` command lacks a version pin,
causing non-deterministic behavior when upstream releases new versions. Pin the
pip-audit tool to a specific version by modifying each occurrence of `pipx run
pip-audit` in the workflow (appearing on lines 28-29, 32-33, 42-43, and 52-53)
to include an explicit version constraint, ensuring consistent and deterministic
behavior across scheduled runs.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 56a05c6c-6f3a-4f1c-a63f-c152be45af0f

📥 Commits

Reviewing files that changed from the base of the PR and between 8f6bc87 and 63cb37e.

⛔ Files ignored due to path filters (1)
  • scripts/infra-mcp/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .github/workflows/dependency-audit.yml
  • .github/workflows/pre-commit.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/pre-commit.yml

Comment thread .github/workflows/dependency-audit.yml
@bubacoder
bubacoder merged commit 3192683 into main Jun 20, 2026
4 checks passed
@bubacoder
bubacoder deleted the feature/audit branch June 20, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant