Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
77ef66e
feat: implement issue #355 — Compliance: secret_scanning_ai_detection
donpetry-bot Jun 10, 2026
431aba0
chore: apply manual instructions [skip ci-relay]
donpetry-bot Jun 10, 2026
7fb4c45
chore: apply manual instructions [skip ci-relay]
donpetry-bot Jun 10, 2026
270953e
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 10, 2026
646625c
fix(ci): use curl for gitleaks download — GITHUB_TOKEN 401s on extern…
donpetry-bot Jun 10, 2026
0c3d839
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
17e019e
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
fb6f917
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
050d6d4
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
5218394
fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay]
donpetry-bot Jun 11, 2026
6a7c48f
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
adb9d2f
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
e1de4f4
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
95733b4
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
3b92806
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
0dff6ac
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
21e9ea6
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 11, 2026
f8f6d8e
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 13, 2026
458a17d
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 13, 2026
eb0f347
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 13, 2026
fcb69ae
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 14, 2026
449e676
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 14, 2026
affb226
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 14, 2026
7f1746e
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 14, 2026
80cdbbe
fix(bot): address bot feedback [skip ci-relay]
donpetry-bot Jun 14, 2026
8d774a9
chore: apply manual instructions [skip ci-relay]
donpetry-bot Jun 14, 2026
c7677b2
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 15, 2026
ff53175
Merge branch 'main' into dev-lead/issue-355-20260610-1424
don-petry Jun 15, 2026
5882f65
Merge branch 'main' into dev-lead/issue-355-20260610-1424
donpetry-bot Jun 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions scripts/lib/push-protection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
PP_REQUIRED_SA_SETTINGS=(
"secret_scanning:enabled:error:Secret scanning must be enabled"
"secret_scanning_push_protection:enabled:error:Secret scanning push protection must be enabled"
"secret_scanning_ai_detection:enabled:warning:Secret scanning AI detection should be enabled"
"secret_scanning_non_provider_patterns:enabled:warning:Secret scanning non-provider patterns should be enabled"
"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)"
Comment thread
don-petry marked this conversation as resolved.
"dependabot_security_updates:enabled:warning:Dependabot security updates should be enabled"
)

Expand Down Expand Up @@ -115,7 +115,34 @@ pp_apply_security_and_analysis() {
full_payload=$(echo "$payload" | jq '{security_and_analysis: .}')

if echo "$full_payload" | gh api -X PATCH "repos/$ORG/$repo" --input - > /dev/null 2>&1; then
ok "$ORG/$repo security_and_analysis updated successfully"
ok "$ORG/$repo security_and_analysis PATCH accepted"

# Verify each patched key was actually applied. Some settings (e.g.
# secret_scanning_ai_detection, secret_scanning_non_provider_patterns)
# require GitHub Advanced Security or a Copilot subscription; the API
# accepts the PATCH (HTTP 200) but silently ignores keys that the org
# plan does not support. Re-fetch and warn for any key still not applied.
local post_patch post_actuals
post_patch=$(gh api "repos/$ORG/$repo" --jq '.security_and_analysis // {}' 2>/dev/null || echo "{}")
post_actuals=$(echo "$post_patch" | jq -r 'to_entries | .[] | "\(.key):\(.value.status? // "null")"' 2>/dev/null || echo "")

local -A actuals
while IFS=':' read -r k v; do
if [ -n "$k" ]; then
actuals["$k"]="$v"
fi
done <<< "$post_actuals"

local post_entry post_key post_expected post_actual
for post_entry in "${PP_REQUIRED_SA_SETTINGS[@]}"; do
IFS=':' read -r post_key post_expected _ _ <<< "$post_entry"
post_actual="${actuals[$post_key]:-null}"
if [ "$post_actual" != "$post_expected" ]; then
warn " $post_key still not $post_expected after PATCH — the org plan may not support this feature (current: $post_actual)"
else
ok " $post_key: $post_actual (verified)"
fi
done
Comment thread
don-petry marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
else
err "Failed to PATCH security_and_analysis for $ORG/$repo — the authenticated token must have repository admin permissions (or the org plan may not support these features)"
return 1
Expand Down
Loading