Skip to content

feat: implement issue #355 — Compliance: secret_scanning_ai_detection#435

Open
don-petry wants to merge 17 commits into
mainfrom
dev-lead/issue-355-20260610-1424
Open

feat: implement issue #355 — Compliance: secret_scanning_ai_detection#435
don-petry wants to merge 17 commits into
mainfrom
dev-lead/issue-355-20260610-1424

Conversation

@don-petry

Copy link
Copy Markdown
Contributor

Closes #355

Implemented by dev-lead agent. Please review.

Copilot AI review requested due to automatic review settings June 10, 2026 14:34
@don-petry don-petry requested a review from a team as a code owner June 10, 2026 14:34
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

More reviews will be available in 16 minutes and 56 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.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1c50ea5f-ac9e-44b4-bd71-dd16af69c92b

📥 Commits

Reviewing files that changed from the base of the PR and between 73231f6 and 21e9ea6.

📒 Files selected for processing (3)
  • scripts/lib/push-protection.sh
  • test/scripts/lib/helpers/setup.bash
  • test/scripts/lib/push-protection.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-355-20260610-1424

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates scripts/lib/push-protection.sh to add detailed explanations for required security settings and introduces a verification step to confirm that settings are successfully applied after a PATCH request. The review feedback recommends optimizing this verification step by parsing the JSON response once into an associative array, which avoids spawning multiple jq processes in a loop and improves execution speed.

Comment thread scripts/lib/push-protection.sh Outdated

Copilot AI 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.

Pull request overview

This PR updates the push-protection compliance library to add additional context around certain security_and_analysis settings (notably secret_scanning_ai_detection and secret_scanning_non_provider_patterns) and to verify whether a successful PATCH actually resulted in the desired state.

Changes:

  • Expanded the audit/apply “human detail” messages for AI detection and non-provider patterns to include plan/feature-availability caveats.
  • Added a post-PATCH re-fetch step in pp_apply_security_and_analysis() to warn when settings remain non-compliant after the API call is accepted.

Comment on lines +45 to +46
"secret_scanning_ai_detection:enabled:warning:Secret scanning AI detection should be enabled (requires GitHub Copilot subscription; absent means the feature is unavailable for the current org plan)"
"secret_scanning_non_provider_patterns:enabled:warning:Secret scanning non-provider patterns should be enabled (requires GitHub Advanced Security)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated pp_check_security_and_analysis() in scripts/lib/push-protection.sh to treat a null/absent status differently from a disabled status for warning-severity settings. When actual == "null" and severity == "warning", the loop now continues without calling add_finding — this covers secret_scanning_ai_detection, secret_scanning_non_provider_patterns, and dependabot_security_updates, all of which return null when the org plan does not support the feature. Error-severity settings (secret_scanning, secret_scanning_push_protection) still always emit findings when non-compliant. Added 10 bats tests in test/scripts/lib/push-protection.bats verifying the boundary conditions (null + warning → no finding, null + error → finding, disabled + warning → finding). ShellCheck passes with no warnings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implemented as described. In scripts/lib/push-protection.sh, pp_check_security_and_analysis() now short-circuits with continue when severity == "warning" and actual == "null" (lines 207-210), so secret_scanning_ai_detection, secret_scanning_non_provider_patterns, and dependabot_security_updates produce no findings when the API returns null (plan-gated feature). Error-severity settings (secret_scanning, secret_scanning_push_protection) still always emit findings when non-compliant. Ten bats tests covering all boundary conditions were added in test/scripts/lib/push-protection.bats — all pass. Also fixed a Tier 1 CI blocker: the Secret scan (gitleaks) job was failing with 401 because gh release download uses GITHUB_TOKEN which is scoped to this repo and cannot access external repo releases. Replaced with curl in both ci.yml and the standards/push-protection.md template.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified. The null-vs-disabled distinction is implemented in scripts/lib/push-protection.sh at lines 207–210: pp_check_security_and_analysis() now short-circuits with continue when severity == "warning" and actual == "null", so secret_scanning_ai_detection, secret_scanning_non_provider_patterns, and dependabot_security_updates produce no findings when the API returns null (plan-gated feature unavailable). Error-severity settings (secret_scanning, secret_scanning_push_protection) still always emit findings when non-compliant. All 10 boundary-condition tests in test/scripts/lib/push-protection.bats pass, and the full 166-test suite is green.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified. The null-vs-disabled distinction is fully implemented in scripts/lib/push-protection.sh at lines 207–210: pp_check_security_and_analysis() short-circuits with continue when severity == "warning" and actual == "null", so secret_scanning_ai_detection, secret_scanning_non_provider_patterns, and dependabot_security_updates produce no findings when the GitHub API returns null (plan-gated feature unavailable on the current org plan). Error-severity settings (secret_scanning, secret_scanning_push_protection) still always emit findings when non-compliant. All 10 boundary-condition tests in test/scripts/lib/push-protection.bats pass (null+warning→no finding, null+error→finding, disabled+warning→finding), and the full 194-test suite is green. ShellCheck passes with no warnings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified by dev-lead agent. The concern is fully addressed: pp_check_security_and_analysis() in scripts/lib/push-protection.sh (lines 207–210) now short-circuits with continue when severity == "warning" and actual == "null", so secret_scanning_ai_detection, secret_scanning_non_provider_patterns, and dependabot_security_updates produce no findings when the GitHub API returns null (plan-gated feature unavailable). Error-severity settings (secret_scanning, secret_scanning_push_protection) still always emit findings when non-compliant. ShellCheck passes with no warnings. Ten boundary-condition bats tests in test/scripts/lib/push-protection.bats cover all cases (null+warning→no finding, null+error→finding, disabled+warning→finding).

Comment thread scripts/lib/push-protection.sh
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry don-petry enabled auto-merge (squash) June 10, 2026 14:50
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 10, 2026
@don-petry don-petry disabled auto-merge June 10, 2026 14:55
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 10, 2026
@sonarqubecloud

Copy link
Copy Markdown

@don-petry don-petry disabled auto-merge June 10, 2026 15:19
…al repos

gh release download uses GITHUB_TOKEN which is repo-scoped and returns
401 Unauthorized when downloading releases from external repos (gitleaks/gitleaks).
Replace with a direct curl call which works for public release assets
without authentication. Update standards/push-protection.md template to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry don-petry disabled auto-merge June 11, 2026 12:16
@don-petry don-petry enabled auto-merge (squash) June 11, 2026 12:21
@don-petry don-petry disabled auto-merge June 11, 2026 12:23
@don-petry don-petry disabled auto-merge June 11, 2026 13:18
@don-petry don-petry enabled auto-merge (squash) June 11, 2026 13:22
@don-petry don-petry disabled auto-merge June 11, 2026 13:31
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
- ✅ 0 Accepted issues
- ✅ 0 Security Hotspots
**No Tier 1 blockers exist:**
- The "Analyze (actions)" check is still queued (not failed)
- No reviews have requested changes
- The copilot and gemini suggestions are COMMENTED, not CHANGES_REQUESTED
**Code review findings:**
- The post-PATCH verification logic already implements the optimization that gemini-code-assist suggested (parsing JSON once into an associative array, not spawning jq multiple times in a loop)
- The PR changes (enhanced context messages and verification) contain no security issues or code quality concerns flagged by SonarCloud
The PR is clean and ready once the Analyze check completes.

@don-petry don-petry enabled auto-merge (squash) June 11, 2026 13:32
@don-petry don-petry disabled auto-merge June 11, 2026 13:42
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
Quality Gate passed with no new issues, hotspots, or security concerns.
Files changed: none
Tier 1 blockers: none
```
The PR is clean from a SonarCloud analysis perspective. No further action is needed on the bot comment.

@don-petry don-petry enabled auto-merge (squash) June 11, 2026 13:42
@don-petry don-petry disabled auto-merge June 11, 2026 13:48
@don-petry don-petry enabled auto-merge (squash) June 11, 2026 13:51
@don-petry don-petry disabled auto-merge June 11, 2026 13:57
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Quality Gate passed with 0 new issues — no action required
Files changed: N/A
Skipped (informational): 0
```
The PR is ready for the remaining CI checks to complete. No changes needed.

@don-petry don-petry enabled auto-merge (squash) June 11, 2026 13:57
@sonarqubecloud

Copy link
Copy Markdown

@don-petry don-petry disabled auto-merge June 11, 2026 14:03
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Quality Gate Passed: no actionable issues found
Files changed: none (quality gate clean)
Skipped (informational): 0
```
The pull request is ready from a code quality perspective. All substantive CI checks have passed, and there are no review comments requesting changes.

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: secret_scanning_ai_detection

3 participants