Skip to content

feat: implement issue #142 — Compliance: secret_scanning_ai_detection - #329

Merged
don-petry merged 2 commits into
mainfrom
dev-lead/issue-142-20260520-1913
May 20, 2026
Merged

don-petry merged 2 commits into
mainfrom
dev-lead/issue-142-20260520-1913

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

Closes #142

Implemented by dev-lead agent. Please review.

Copilot AI review requested due to automatic review settings May 20, 2026 19:20
@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

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 @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: 73331089-ffe1-4247-ada7-3068356d1695

📥 Commits

Reviewing files that changed from the base of the PR and between 6d9bcdc and c0255d2.

📒 Files selected for processing (2)
  • scripts/aw-standards-sync.sh
  • tests/aw/standards-sync/scenarios.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-142-20260520-1913

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

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 introduces automated enforcement of repository security settings, specifically enabling AI-based secret scanning detection, and updates the reporting logic to track these changes. A review comment correctly points out that the compliance counter is incremented even when security settings fail to apply, which could lead to misleading reports. A code suggestion was provided to distinguish between successful updates and errors, ensuring that only repositories meeting all standards are marked as compliant.

Comment on lines +165 to 171
elif [ "${#missing_files[@]}" -eq 0 ]; then
# Files compliant but security settings were applied/errored
compliant_count=$((compliant_count + 1))
echo " [ok] ${repo} (security settings updated)"
summary_rows="${summary_rows}| \`${repo}\` | ✅ | ✅ | Security settings:${security_notes} |\n"
continue
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The compliant_count is incremented even if security settings failed to apply (indicated by :error in security_notes). A repository should only be considered compliant if all standards, including security settings, are successfully met. Marking a repo as [ok] and incrementing the counter when an error occurred is misleading. Inline error handling should be used to distinguish between success and failure states, ensuring intent is not obscured.

Suggested change
elif [ "${#missing_files[@]}" -eq 0 ]; then
# Files compliant but security settings were applied/errored
compliant_count=$((compliant_count + 1))
echo " [ok] ${repo} (security settings updated)"
summary_rows="${summary_rows}| \`${repo}\` | ✅ | ✅ | Security settings:${security_notes} |\n"
continue
fi
elif [ "${#missing_files[@]}" -eq 0 ]; then
# Files compliant but security settings were applied/errored
if [[ "$security_notes" == *":error"* ]]; then
echo " [warn] ${repo} (security settings failed)"
summary_rows="${summary_rows}| ${repo} | ✅ | ✅ | Security settings error:${security_notes} |\n"
else
compliant_count=$((compliant_count + 1))
echo " [ok] ${repo} (security settings updated)"
summary_rows="${summary_rows}| ${repo} | ✅ | ✅ | Security settings:${security_notes} |\n"
fi
continue
fi
References
  1. Keep error routing logic inline when tiers have distinct requirements to avoid obscuring intent or introducing false positives.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 67e6c5502c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +167 to +169
compliant_count=$((compliant_count + 1))
echo " [ok] ${repo} (security settings updated)"
summary_rows="${summary_rows}| \`${repo}\` | ✅ | ✅ | Security settings:${security_notes} |\n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not mark repos compliant when security enforcement fails

When secret_scanning_ai_detection cannot be read or enabled (for example due to missing permissions or unavailable Advanced Security), security_notes is set to an error value, but this branch still increments compliant_count and logs the repo as [ok]. That makes the summary totals report these repos as compliant even though a required security control is still missing or unknown, which can mask real compliance gaps in the monthly report.

Useful? React with 👍 / 👎.

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

Note

Copilot was unable to run its full agentic suite in this review.

Implements compliance enforcement for the secret_scanning_ai_detection repository security setting (issue #142) and updates the standards-sync reporting/scenarios to reflect security settings applied.

Changes:

  • Add enforcement logic to detect and enable secret_scanning_ai_detection via GitHub API during standards sync runs.
  • Extend the summary issue to include a “security settings applied” counter and actions.
  • Add test scenario documentation for missing/already-enabled/unavailable Advanced Security cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
tests/aw/standards-sync/scenarios.md Adds scenarios for secret_scanning_ai_detection enforcement and updates summary expectations.
scripts/aw-standards-sync.sh Enforces required security setting(s), tracks settings_applied, and updates summary output.

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

**Then**
- a summary issue is opened in `.github-private` listing compliance status
- the issue shows: total repos scanned, compliant count, PRs opened count
- the issue shows: total repos scanned, compliant count, PRs opened count, security settings applied count
**When** the monthly schedule fires
**Then**
- the workflow detects the missing security setting via the GitHub API
- it applies a PATCH to `repos/{repo}` enabling `secret_scanning_ai_detection`
Comment on lines +154 to +156
echo " [warn] ${repo} — could not enable ${setting_label} (may require Advanced Security)"
security_notes="${security_notes} \`${setting_label}\`:error"
fi
Comment on lines +165 to +170
elif [ "${#missing_files[@]}" -eq 0 ]; then
# Files compliant but security settings were applied/errored
compliant_count=$((compliant_count + 1))
echo " [ok] ${repo} (security settings updated)"
summary_rows="${summary_rows}| \`${repo}\` | ✅ | ✅ | Security settings:${security_notes} |\n"
continue
Comment on lines +134 to +140
for setting_entry in "${REQUIRED_SECURITY_SETTINGS[@]}"; do
setting_label="${setting_entry%%|*}"
_rest="${setting_entry#*|}"
jq_path="${_rest%%|*}"
api_payload="${_rest#*|}"

current_val=$(gh api "repos/${repo}" --jq "${jq_path} // \"null\"" 2>/dev/null || echo "error")
@don-petry
don-petry merged commit 2f97e69 into main May 20, 2026
19 of 20 checks passed
@don-petry
don-petry deleted the dev-lead/issue-142-20260520-1913 branch May 20, 2026 19:36
@sonarqubecloud

Copy link
Copy Markdown

don-petry added a commit that referenced this pull request Jun 7, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 7, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 8, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 12, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 14, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 18, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
…#329)

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
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