fix: exempt internal reusable workflow refs from action-pinning check#242
fix: exempt internal reusable workflow refs from action-pinning check#242don-petry wants to merge 30 commits into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
|
CI is green (Lint, ShellCheck, AgentShield, SonarCloud all pass). CodeQL is still running but typically passes for bash-only changes. Self-review notes:
@petry-projects/org-leads — this PR fixes a false-positive in the compliance audit. Ready for review and merge. |
There was a problem hiding this comment.
Code Review
This pull request updates the compliance audit script to exempt internal reusable workflows from SHA-pinning requirements, aligning with organizational policy. The review feedback identifies a potential issue where the broad regex used for the exemption could lead to false negatives if the exclusion string appears within a comment on a line containing an unpinned third-party action. A more robust, anchored regex was suggested to ensure the exemption only applies to the action reference itself.
| # standards/ci-standards.md#exception-internal-reusable-workflow-references | ||
| local unpinned | ||
| unpinned=$(echo "$decoded" | grep -E '^\s*-?\s*uses:\s+[^#]*@' | grep -vE '@[0-9a-f]{40}' | grep -vE '(docker://|\.\/)' || true) | ||
| unpinned=$(echo "$decoded" | grep -E '^\s*-?\s*uses:\s+[^#]*@' | grep -vE '@[0-9a-f]{40}' | grep -vE '(docker://|\.\/)' | grep -vE 'petry-projects/\.github/' || true) |
There was a problem hiding this comment.
The regex petry-projects/\.github/ is applied to the entire line, which can lead to false negatives if a workflow file contains comments referencing the internal repository on the same line as an unpinned third-party action (e.g., uses: actions/checkout@v4 # see petry-projects/.github/).
To ensure the exemption only applies to the action reference itself and to improve the robustness of the existing exclusions, I suggest anchoring the regex to the uses: directive and consolidating the exclusions into a single anchored pattern.
| unpinned=$(echo "$decoded" | grep -E '^\s*-?\s*uses:\s+[^#]*@' | grep -vE '@[0-9a-f]{40}' | grep -vE '(docker://|\.\/)' | grep -vE 'petry-projects/\.github/' || true) | |
| unpinned=$(echo "$decoded" | grep -E '^\s*-?\s*uses:\s+[^#]*@' | grep -vE '@[0-9a-f]{40}' | grep -vE '^\s*-?\s*uses:\s+(docker://|\.\/|petry-projects/\.github/)' || true) |
There was a problem hiding this comment.
Pull request overview
Updates the org-wide compliance audit script to align check_action_pinning behavior with the documented exception that internal petry-projects/.github reusable workflows may use tag refs (e.g., @v1) instead of SHA pins, avoiding false-positive compliance findings.
Changes:
- Excludes
petry-projects/.githubreusable workflow references from the unpinned-action detection pipeline inscripts/compliance-audit.sh. - Adds inline comments linking the exclusion to the corresponding standards exception section.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: dc45fcd0a7cc56e045e81aad46b41a1f9b52e3fc
Review mode: triage-approved (single reviewer)
Summary
Confirms the triage assessment. This is a 4-line change to scripts/compliance-audit.sh adding a grep -vE 'petry-projects/\.github/' exclusion to check_action_pinning, with a clear inline comment pointing at the relevant exception in standards/ci-standards.md. Internal reusable workflow refs intentionally use @v1 tags rather than SHA pins, and the previous logic was generating false-positive compliance findings against caller stubs like dependabot-automerge.yml.
Linked issue analysis
Closes #239 (Compliance: unpinned-actions-dependabot-automerge.yml). The issue is itself an auto-filed false-positive — it flagged petry-projects/.github/.github/workflows/dependabot-automerge-reusable.yml@v1, which is exactly the kind of internal ref the new exclusion targets. Fix is substantively aligned with the issue.
Findings
- Scope is appropriately narrow. Only one function (
check_action_pinning) is touched; existing exclusions fordocker://and./are preserved. - Regex correctness.
petry-projects/\.github/correctly escapes the dot and includes a trailing/, so it won't spuriously exempt a hypotheticalpetry-projects/.github-otherrepo. - Minor nit (non-blocking, noted by gemini-code-assist). The new
grep -vEruns against full lines rather than the captureduses:ref. A line likeuses: actions/checkout@v4 # see petry-projects/.github/...would be silently filtered, masking a real third-party finding. Probability is very low in practice, and the surrounding pipeline already partially mitigates via[^#]*@. A future hardening could anchor the exclusion to the@portion of the ref. Not a blocker for this fix. - No security regression. The exemption is policy-aligned (documented in
standards/ci-standards.md#exception-internal-reusable-workflow-references); it does not weaken pinning for any third-party action.
CI status
All required checks green: Lint, ShellCheck, Agent Security Scan, AgentShield, SonarCloud, CodeQL, Claude Code, CodeRabbit, Dependency audit (ecosystem detector). Skipped jobs are conditional (Dependabot auto-merge, mention triggers, language-specific audits not applicable to this repo). SonarCloud Quality Gate passed with 0 new issues.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
Pull request was closed
The merge-base changed after approval.
|
Auto-rebase failed — merge conflict — this branch has conflicts with Please resolve the conflicts and push: |
The check_action_pinning function was flagging `petry-projects/.github` reusable workflow refs (e.g. `@v1`) as unpinned. However, ci-standards.md explicitly exempts these from the SHA-pinning policy — internal reusable workflow refs use tags by design and must NOT be SHA-pinned. Add a grep exclusion for `petry-projects/.github/` refs so the audit no longer generates false-positive findings like issue #239. Closes #239 Co-authored-by: Don Petry <don-petry@users.noreply.github.com>
c17229f to
8913355
Compare
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 802ad9bcaa94c13aa7383878957083951ad35997
Review mode: triage-approved (single reviewer)
Summary
Confirms the triage assessment. This is a 4-line change to scripts/compliance-audit.sh adding a grep -vE 'petry-projects/\.github/' exclusion to check_action_pinning, with an inline comment pointing at the documented exemption in standards/ci-standards.md#exception-internal-reusable-workflow-references. Since the prior (dismissed) review at c17229f, the only new commits are two merge-from-main commits (72305e4a, 802ad9bc) — no functional drift, the fix itself is unchanged.
Linked issue analysis
Closes #239 (Compliance: unpinned-actions-dependabot-automerge.yml), an auto-filed false-positive flagging petry-projects/.github/.github/workflows/dependabot-automerge-reusable.yml@v1. That ref is exactly the kind of internal reusable workflow the new exclusion targets, and standards/ci-standards.md explicitly exempts these refs from SHA pinning. Substantively addressed.
Findings
- Scope is appropriately narrow. Only one function (
check_action_pinning) is touched; existing exclusions fordocker://and./are preserved. - Regex correctness.
petry-projects/\.github/correctly escapes the dot and includes a trailing/, so it won't spuriously exempt a hypotheticalpetry-projects/.github-otherrepo. - Minor nit (non-blocking, previously noted by gemini-code-assist). The
grep -vEruns against full lines rather than the captureduses:ref. A line likeuses: actions/checkout@v4 # see petry-projects/.github/...would be silently filtered, masking a real third-party finding. Probability is very low in practice and the upstream[^#]*@partially mitigates. A future hardening could anchor the exclusion to the@-ref portion; not a blocker. - No security regression. The exemption is policy-aligned; it does not weaken pinning for any third-party action.
- Merge state.
mergeable: MERGEABLE;mergeStateStatus: BLOCKEDreflects review-required, not conflict. The earlierauto-rebase-conflictcomment from 2026-05-12 has since been resolved by the two merge-from-main commits.
CI status
Green: CodeQL (Analyze actions) SUCCESS, CodeRabbit SUCCESS. Author-reported additional checks (Lint, ShellCheck, AgentShield, SonarCloud Quality Gate — 0 new issues) also passed.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 146bf90460a6ca6dfbd7b76cb94d9d9421d23b4c
Review mode: triage-approved (single reviewer)
Summary
Confirms the triage assessment. This is a 4-line change to scripts/compliance-audit.sh adding a grep -vE 'petry-projects/\.github/' exclusion to check_action_pinning, with an inline comment pointing at the documented exemption in standards/ci-standards.md#exception-internal-reusable-workflow-references. Since the prior approved review at 802ad9bc, the only new commits are two merge-from-main commits (a70a6ea0, 146bf904) that pull in unrelated upstream work (#281 auto-rebase fallback, #275 check-suite trigger fix); the fix itself is unchanged.
Linked issue analysis
Closes #239 (Compliance: unpinned-actions-dependabot-automerge.yml), an auto-filed false-positive flagging petry-projects/.github/.github/workflows/dependabot-automerge-reusable.yml@v1. That ref is exactly the kind of internal reusable workflow the new exclusion targets, and standards/ci-standards.md explicitly exempts these refs from SHA pinning. Substantively addressed.
Findings
- Scope is appropriately narrow. Only one function (
check_action_pinning) is touched; existing exclusions fordocker://and./are preserved. - Regex correctness.
petry-projects/\.github/correctly escapes the dot and includes a trailing/, so it won't spuriously exempt a hypotheticalpetry-projects/.github-otherrepo. - Minor nit (non-blocking, previously noted by gemini-code-assist). The
grep -vEruns against full lines rather than the captureduses:ref. A line likeuses: actions/checkout@v4 # see petry-projects/.github/...would be silently filtered, masking a real third-party finding. Probability is very low in practice and the upstream[^#]*@partially mitigates. A future hardening could anchor the exclusion to the@-ref portion; not a blocker. - No security regression. The exemption is policy-aligned; it does not weaken pinning for any third-party action.
- Merge state.
mergeable: MERGEABLE;mergeStateStatus: BLOCKEDreflects review-required, not conflict. The earlierauto-rebase-conflictcomment from 2026-05-12 has since been resolved by the merge-from-main commits.
CI status
All required checks green: Lint, ShellCheck, Agent Security Scan, Secret scan (gitleaks), AgentShield, SonarCloud (Quality Gate passed — 0 new issues), CodeQL (Analyze actions), Claude Code, CodeRabbit, Dependency audit (ecosystem detector). Skipped jobs are conditional (Dependabot auto-merge, language-specific audits not applicable, mention-triggered Claude jobs).
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
|
@dev-lead - please fix this PR |
|
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |



Summary
check_action_pinningfunction inscripts/compliance-audit.shwas generating false-positive findings forpetry-projects/.githubreusable workflow refs (e.g.@v1tags)standards/ci-standards.md#exception-internal-reusable-workflow-referencesexplicitly exempts these refs from SHA pinning — they intentionally use tags and must NOT be SHA-pinnedgrep -vE 'petry-projects/\.github/'exclusion to filter out these refs from the unpinned-action detectionTest plan
dependabot-automerge.yml(or any other Tier 1 caller stub) for using@v1on internal reusable workflow refsactions/checkout@v4)scripts/compliance-audit.shwithDRY_RUN=trueto confirm no false-positiveaction-pinningfindings in the.githubrepoCloses #239
Generated with Claude Code