Skip to content

fix(compliance-audit): eliminate false positives + apply API-based fixes#120

Merged
don-petry merged 3 commits intomainfrom
claude/issue-119-20260409-1218
Apr 10, 2026
Merged

fix(compliance-audit): eliminate false positives + apply API-based fixes#120
don-petry merged 3 commits intomainfrom
claude/issue-119-20260409-1218

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

@don-petry don-petry commented Apr 9, 2026

Summary

Addresses all actionable findings from the 2026-04-09 compliance audit (issue #119).

Changes in this PR

scripts/compliance-audit.sh — three false-positive fixes:

  • Dependabot YAML quote style — old grep patterns required "double-quoted" YAML values for ecosystem names and labels; YAML permits both styles. Patterns updated to accept 'single-quoted' as well. This resolves the missing-github-actions-ecosystem, missing-security-label, and missing-dependencies-label findings for google-app-scripts (whose dependabot.yml uses single quotes).

  • Reusable workflow permissions — the permissions check now skips workflow_call-only workflows (*-reusable.yml). Reusable workflows inherit permissions from their caller, so requiring a top-level permissions: block in them was incorrect. This resolves the four missing-permissions-*-reusable.yml findings for the .github repo.

  • AGENTS.md org reference — the check now accepts GitHub blob URLs (petry-projects/.github/blob/<branch>/AGENTS.md) in addition to the canonical path format (.github/AGENTS.md in link text). Both unambiguously point to the org-level standards file. This resolves agents-md-missing-org-ref for ContentTwin and markets.

API-based fixes applied directly (no file changes required)

These were applied via the GitHub API as part of this remediation and will show as compliant in the next audit run:

Fix Repos
CodeQL default setup enabled markets, google-app-scripts, ContentTwin, broodly, bmad-bgreat-suite, TalkTerm
pr-quality ruleset created .github, google-app-scripts
code-quality ruleset created .github, google-app-scripts

Remaining open items (require GH_PAT_WORKFLOWS secret or manual action)

The following findings affect .github/workflows/*.yml files in various repos. GitHub App tokens cannot write to workflow files without the workflows scope (GH_PAT_WORKFLOWS secret). These must be fixed manually or via a PAT-enabled run:

  • SHA pinningunpinned-actions-*.yml across all repos
  • Stray codeql.yml files — these per-repo workflow files should be removed now that GitHub-managed CodeQL default setup is enabled; the check stray-codeql-workflow will clear once removed
  • Missing ci.ymlTalkTerm needs a CI pipeline added
  • required-claude-check-brokenTalkTerm ruleset references a check that no longer exists

Closes #119

Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved compliance audit parsing to handle quoted ecosystem names more flexibly, and to extract relevant config blocks more reliably.
    • Relaxed label detection to recognize security/dependencies labels with single or double quotes.
    • Exempted reusable workflow files from top-level permissions enforcement to reduce false positives.
    • Broadened AGENTS.md validation to accept org-level or various repository references.

Copilot AI review requested due to automatic review settings April 9, 2026 12:35
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4bffd6d7-4460-4b24-987f-a4c25d015fa0

📥 Commits

Reviewing files that changed from the base of the PR and between 745825a and 9d5c4e7.

📒 Files selected for processing (1)
  • scripts/compliance-audit.sh
📝 Walkthrough

Walkthrough

Updated the compliance audit script to parse Dependabot ecosystems and labels with quote-flexible regex, adjust ecosystem block extraction, exempt reusable *-reusable.yml workflows from top-level permissions checks, and broaden AGENTS.md validation to accept relative paths or org-level GitHub blob URLs.

Changes

Cohort / File(s) Summary
Compliance Audit Script
scripts/compliance-audit.sh
Refined Dependabot YAML parsing to accept single- or double-quoted package-ecosystem and app ecosystems; adjusted awk heuristics to extract ecosystem blocks without requiring double quotes; made required-label detection accept single- or double-quoted security/dependencies; skip permission findings for *-reusable.yml/.yaml files; accept .github/AGENTS.md or org-level GitHub blob URL references in AGENTS.md check.

Sequence Diagram(s)

(omitted — changes are script logic tweaks within a single component)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

🚥 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 clearly summarizes the main change: fixing compliance audit script to eliminate false positives and applying API-based fixes.
Linked Issues check ✅ Passed The PR successfully addresses coding requirements from issue #119: fixing Dependabot YAML quote handling, reusable workflow permissions checks, and AGENTS.md org references.
Out of Scope Changes check ✅ Passed All changes in scripts/compliance-audit.sh are directly scoped to fix false positives identified in issue #119; no unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 claude/issue-119-20260409-1218

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.

@don-petry
Copy link
Copy Markdown
Contributor Author

@don-petry — this PR fixes the false positives in the compliance audit script identified in issue #119, plus applies API-based fixes (CodeQL setup and rulesets). Please review and merge when ready.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the org compliance audit script to reduce false positives and align checks with how the standards are applied across repositories.

Changes:

  • Relaxed Dependabot YAML matching to accept single-quoted ecosystem names and labels.
  • Updated workflow permissions auditing to skip workflow_call-only reusable workflows.
  • Expanded AGENTS.md org-reference detection to accept GitHub blob-style URLs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/compliance-audit.sh Outdated
Comment thread scripts/compliance-audit.sh Outdated
Comment thread scripts/compliance-audit.sh Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/compliance-audit.sh`:
- Around line 793-797: The grep regex that checks $decoded currently uses
"petry-projects/\.github/blob/[^/]+/AGENTS\.md" which rejects branch names
containing slashes; update the pattern used in the if test to allow any
characters (including slashes) between "blob/" and "/AGENTS.md" (for example
replace the "[^/]+” segment with ".+"), i.e. adjust the grep -qE pattern that
references $decoded so it matches "petry-projects/\.github/blob/.+/AGENTS\.md"
while keeping the existing "\.github/AGENTS\.md" alternative.
- Around line 489-494: Replace the brittle on: extraction and whitelist logic
(the on_triggers variable computed from decoded and the subsequent grep checks)
with a simple filename-based check: detect reusable workflows by testing the
workflow file name for the suffix -reusable.yml or -reusable.yaml (i.e., if
filename ends with -reusable.yml or -reusable.yaml then treat as reusable and
continue), and remove the awk/grep on_triggers logic that inspects decoded to
avoid inline syntax and missing-trigger edge cases. Ensure you use the existing
loop's filename variable (the variable used to hold the current workflow file)
in the new check and delete the on_triggers and related grep blocks.
🪄 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: d2c157b5-1dce-42ee-bcac-c465efa4a097

📥 Commits

Reviewing files that changed from the base of the PR and between a3e9658 and 42fdee0.

📒 Files selected for processing (1)
  • scripts/compliance-audit.sh

Comment thread scripts/compliance-audit.sh Outdated
Comment thread scripts/compliance-audit.sh Outdated
github-actions Bot and others added 2 commits April 9, 2026 18:04
- Dependabot YAML quote style: grep patterns now accept both
  single-quoted ('github-actions') and double-quoted ("github-actions")
  YAML values. YAML allows either; the old patterns required double
  quotes, flagging valid single-quoted configs as non-compliant.

- Workflow permissions: reusable workflows (workflow_call-only triggers)
  are now skipped. Their permissions are set by the caller, so requiring
  a top-level permissions: block in *-reusable.yml files was a false
  positive that blocked every org-level reusable workflow.

- AGENTS.md org reference: accept GitHub blob URLs
  (petry-projects/.github/blob/<branch>/AGENTS.md) in addition to the
  canonical path format (.github/AGENTS.md in link text). Both forms
  unambiguously point to the org-level standards file.

Closes #119 (partial — API-based fixes applied separately)

Co-authored-by: don-petry <don-petry@users.noreply.github.com>
- Replace brittle awk/grep reusable-workflow detection with filename
  convention check (*-reusable.yml), avoiding false skips from unlisted
  triggers or inline on: syntax
- Fix blob URL regex to allow slashed branch names (blob/.+/AGENTS.md
  instead of blob/[^/]+/AGENTS.md)
- Align comment with what the regex actually matches

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@scripts/compliance-audit.sh`:
- Around line 249-256: The awk block extraction uses an unquoted pattern that
can falsely match substrings (e.g., "pnpm" when eco=npm); update the awk pattern
used in the block assignment (the command that builds variable `block` using awk
"/package-ecosystem:.*$eco/{...}") to require the ecosystem name to be quoted
the same way as the earlier grep (match either double-quoted or single-quoted
"$eco"/'$eco') and ensure the exit condition `!/$eco/` is changed to use the
same quoted-aware match so the block stops at the next ecosystem entry
correctly.
🪄 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: 6b30d569-1452-40c6-b9b3-ae85c7e3a683

📥 Commits

Reviewing files that changed from the base of the PR and between 42fdee0 and 745825a.

📒 Files selected for processing (1)
  • scripts/compliance-audit.sh

Comment thread scripts/compliance-audit.sh Outdated
@don-petry don-petry force-pushed the claude/issue-119-20260409-1218 branch from 745825a to 4b906a5 Compare April 10, 2026 01:07
…traction

The awk pattern used unquoted $eco which caused "npm" to substring-match
"pnpm", potentially spanning the extracted block into the wrong ecosystem
entry. Align awk with the existing grep by requiring quoted values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@don-petry don-petry merged commit 7bdbb81 into main Apr 10, 2026
19 checks passed
@don-petry don-petry deleted the claude/issue-119-20260409-1218 branch April 10, 2026 01:10
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.

Compliance audit — 2026-04-09

2 participants