ci: verify codeql guard search hits against file contents#33
Conversation
PR SummaryMedium Risk Overview Search hits that can’t be verified (API/auth failures) are still preserved as potential violations, while stale/tokenized matches are skipped with a notice to reduce false positives. Reviewed by Cursor Bugbot for commit 6b0897a. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Grep misses
- uses:YAML shorthand format- The workflow verification regex now accepts an optional YAML list prefix before
uses:, so shorthand- uses:CodeQL steps are detected correctly.
- The workflow verification regex now accepts an optional YAML list prefix before
Preview (6b0897a18e)
diff --git a/.github/workflows/codeql-guard.yml b/.github/workflows/codeql-guard.yml
--- a/.github/workflows/codeql-guard.yml
+++ b/.github/workflows/codeql-guard.yml
@@ -81,7 +81,19 @@
if [ "${repo}" = "evalops/.github" ] && [ "${path}" = ".github/workflows/codeql-guard.yml" ]; then
continue
fi
- hits+=("${repo}"$'\t'"${path}")
+ if ! content="$(
+ GH_TOKEN="${ORG_CODE_SEARCH_TOKEN}" gh api "repos/${repo}/contents/${path}" --jq '.content' |
+ base64 --decode
+ )"; then
+ echo "::warning::Could not verify ${repo}:${path}; preserving search hit."
+ hits+=("${repo}"$'\t'"${path}")
+ continue
+ fi
+ if grep -Eq '^[[:space:]]*(-[[:space:]]*)?uses:[[:space:]]*github/codeql-action([/@]|[[:space:]]|$)' <<< "${content}"; then
+ hits+=("${repo}"$'\t'"${path}")
+ else
+ echo "::notice::Skipping stale or non-use search hit ${repo}:${path}"
+ fi
done <<< "${response}"
if [ "${#hits[@]}" -eq 0 ]; then
echo "ok: no CodeQL workflow files found in any evalops repo"You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit a1763e4. Configure here.
a1763e4 to
6b0897a
Compare

Summary
uses: github/codeql-actionstepVerification
ruby -e 'require "yaml"; YAML.load_file(".github/workflows/codeql-guard.yml")'\n-git diff --check\n- live search/filter smoke: staleevalops/deploy:.github/workflows/container-scan.ymlsearch hit was skipped and verified_hits=0\n\nFollow-up to ci: narrow codeql guard org sweep query #30 and codeql-guard: CodeQL workflow drift detected #32.