Skip to content
Merged
Changes from all commits
Commits
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
23 changes: 17 additions & 6 deletions .github/workflows/codeql-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
ORG_CODE_SEARCH_TOKEN: ${{ secrets.EVALOPS_ORG_READ_TOKEN }}
steps:
- name: Search org for github/codeql-action references
- name: Search org for github/codeql-action uses
shell: bash
run: |
set -euo pipefail
Expand All @@ -68,19 +68,30 @@ jobs:
fi
response="$(
GH_TOKEN="${ORG_CODE_SEARCH_TOKEN}" gh api -X GET search/code \
-f q='org:evalops "github/codeql-action" path:.github/workflows' \
--jq '.items[] | "\(.repository.full_name)\t\(.path)"' \
-f q='org:evalops "uses: github/codeql-action" path:.github/workflows' \
Comment thread
cursor[bot] marked this conversation as resolved.
--jq '.items[]
| select(.repository.full_name != "evalops/.github" or .path != ".github/workflows/codeql-guard.yml")
| "\(.repository.full_name)\t\(.path)"' \
)"
if [ -z "${response}" ]; then
hits=()
while IFS=$'\t' read -r repo path; do
if [ -z "${repo}" ]; then
continue
fi
if [ "${repo}" = "evalops/.github" ] && [ "${path}" = ".github/workflows/codeql-guard.yml" ]; then
continue
fi
hits+=("${repo}"$'\t'"${path}")
done <<< "${response}"
if [ "${#hits[@]}" -eq 0 ]; then
echo "ok: no CodeQL workflow files found in any evalops repo"
exit 0
fi
mapfile -t hits <<< "${response}"
{
echo "## codeql-guard tripped"
echo
echo "EvalOps does not run GitHub CodeQL (see \`SECURITY.md\` and the Blacksmith"
echo "code security configuration). The following workflow files reference"
echo "code security configuration). The following workflow files use"
echo "\`github/codeql-action\` and need to be removed or the policy amended:"
echo
for h in "${hits[@]}"; do
Expand Down
Loading