chore: add cargo-audit CI gate and CHANGELOG skeleton#85
Conversation
📝 WalkthroughWalkthroughThis PR establishes project release management infrastructure and supply-chain security. It introduces a Keep-a-Changelog file documenting past and future releases, enables version-controlled dependency tracking via ChangesRelease Management and Dependency Tracking
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/ci.yml:
- Line 16: Replace the mutable actions/checkout@v4 reference with the GitHub
Actions runner pinned to a full commit SHA: locate the workflow step that uses
"actions/checkout@v4" and change it to "actions/checkout@<FULL_COMMIT_SHA>"
where <FULL_COMMIT_SHA> is the exact commit SHA from the actions/checkout
repository for the v4 tag (use the official actions/checkout repo to copy the
commit SHA), commit the updated workflow, and ensure the workflow still runs
successfully in CI.
- Line 12: The audit job currently lacks least-privilege settings and uses a
mutable checkout tag; add a top-level permissions: block granting only the
minimal scopes needed for the workflow (e.g., contents: read for GITHUB_TOKEN),
update the jobs.audit checkout step to include persist-credentials: false to
avoid leaving the token in the repo remote, and replace actions/checkout@v4 with
a specific pinned commit SHA for the actions/checkout reference to satisfy
supply-chain pinning.
🪄 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: CHILL
Plan: Pro
Run ID: eb28ed31-685f-4bf4-a243-0568a3797f27
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.github/workflows/ci.yml.gitignoreCHANGELOG.mdREADME.md
💤 Files with no reviewable changes (1)
- .gitignore
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| audit: |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE=".github/workflows/ci.yml"
echo "== File: $FILE =="
ls -l "$FILE" || true
echo
echo "== Workflow (lines 1-200) =="
nl -ba "$FILE" | sed -n '1,200p'
echoRepository: api7/lua-qjson
Length of output: 261
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE=".github/workflows/ci.yml"
echo "== First 200 lines (numbered) =="
cat -n "$FILE" | sed -n '1,200p'
echo
echo "== Find permissions blocks =="
rg -n "^\s*permissions\s*:" "$FILE" || true
echo
echo "== Extract jobs.audit section (best-effort) =="
# Print from 'jobs:' until end (bounded) to locate audit job
cat -n "$FILE" | sed -n '1,200p' | sed -n '/jobs:/,/^ [a-zA-Z0-9_-]+:/p'Repository: api7/lua-qjson
Length of output: 15043
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE=".github/workflows/ci.yml"
echo "== File length =="
wc -l "$FILE"
echo
echo "== permissions: occurrences =="
rg -n "^\s*permissions\s*:" "$FILE" || true
echo
echo "== persist-credentials occurrences =="
rg -n "persist-credentials" "$FILE" || true
echo
echo "== actions/checkout steps =="
rg -n "uses:\s*actions/checkout@" "$FILE" -n || true
echo
echo "== Show actions/checkout blocks (context) =="
rg -n "uses:\s*actions/checkout@" "$FILE" -n -C 3 || trueRepository: api7/lua-qjson
Length of output: 1297
Add least-privilege permissions for the audit job
- The workflow has no top-level
permissions:block, so the defaultGITHUB_TOKENscopes are broader than necessary forjobs.audit. jobs.auditusesactions/checkout@v4withoutpersist-credentials: false, leaving the token configured in the git remote.actions/checkoutis referenced via a mutable tag (@v4); pin to a commit SHA to match strict supply-chain policy.
Suggested patch
name: CI
on:
push:
branches: [master, main]
pull_request:
+permissions:
+ contents: read
+
env:
CARGO_TERM_COLOR: always🧰 Tools
🪛 zizmor (1.25.2)
[warning] 12-26: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 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/ci.yml at line 12, The audit job currently lacks
least-privilege settings and uses a mutable checkout tag; add a top-level
permissions: block granting only the minimal scopes needed for the workflow
(e.g., contents: read for GITHUB_TOKEN), update the jobs.audit checkout step to
include persist-credentials: false to avoid leaving the token in the repo
remote, and replace actions/checkout@v4 with a specific pinned commit SHA for
the actions/checkout reference to satisfy supply-chain pinning.
| name: Supply-chain audit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 |
There was a problem hiding this comment.
Pin actions/checkout to a full commit SHA.
.github/workflows/ci.yml (line 16) uses the mutable tag actions/checkout@v4; pinning to an immutable commit SHA improves CI supply-chain integrity.
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 16-16: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 16-16: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 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/ci.yml at line 16, Replace the mutable actions/checkout@v4
reference with the GitHub Actions runner pinned to a full commit SHA: locate the
workflow step that uses "actions/checkout@v4" and change it to
"actions/checkout@<FULL_COMMIT_SHA>" where <FULL_COMMIT_SHA> is the exact commit
SHA from the actions/checkout repository for the v4 tag (use the official
actions/checkout repo to copy the commit SHA), commit the updated workflow, and
ensure the workflow still runs successfully in CI.
Closes #64 (partial), #66 (partial)
Summary by CodeRabbit
New Features
Chores