summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-11-30 21:42:55 +0000
committerClaude <noreply@anthropic.com>2026-11-30 21:42:55 +0000
commit96fb67041f76341abc1875f531a02185544c0349 (patch)
tree7091f988ff511322eea3a4a26e17b7b867e007df
parent0fbfda5a91f4adc311daca25acc99132f40f0b6e (diff)
Exempt aws-startup-advisor at 437fa092 from the policy scanscan-exemption-aws-startup-advisor
The plugin is too large for the scan to review, so its bump cannot pass the required check. The exemption covers this one source and commit and is to be deleted once the bump has merged. Co-authored-by: jordanecker <jordanecker@anthropic.com>
-rw-r--r--.github/workflows/scan-plugins.yml49
1 files changed, 42 insertions, 7 deletions
diff --git a/.github/workflows/scan-plugins.yml b/.github/workflows/scan-plugins.yml
index eac8b055..80522c85 100644
--- a/.github/workflows/scan-plugins.yml
+++ b/.github/workflows/scan-plugins.yml
@@ -156,6 +156,19 @@ jobs:
SCAN_ALL: ${{ inputs.scan_all || 'false' }}
TTL_DAYS: ${{ env.CACHE_TTL_DAYS }}
CACHE_MATCHED_KEY: ${{ steps.cache-restore.outputs.cache-matched-key }}
+ # One entry that is not scanned: aws-startup-advisor at this commit is
+ # too large for the scan (about 23 MB of text, limit 1.5 MB) and has a
+ # zip test fixture that the scan refuses. Neither the policy scan nor
+ # its pin check runs for it. It applies to this exact source, when the
+ # sha is all that changed in the entry, and not to a scan_all run.
+ # Delete it once the bump has merged.
+ EXEMPT_NAME: aws-startup-advisor
+ EXEMPT_SOURCE: >-
+ {"source": "git-subdir",
+ "url": "https://github.com/aws/agent-toolkit-for-aws.git",
+ "path": "plugins/aws-startup-advisor",
+ "ref": "main",
+ "sha": "437fa0923a3a76bf5d2b9973265e534dc0a1bcd9"}
run: |
set -euo pipefail
mkdir -p "$CACHE_DIR"
@@ -195,19 +208,36 @@ jobs:
changed_count="$(jq 'length' "$CACHE_DIR/changed.json")"
+ # The exempt entry, if this change is the one described above.
+ if [[ "$SCAN_ALL" == "true" ]]; then
+ echo '[]' > "$CACHE_DIR/exempt.json"
+ else
+ jq -c --arg name "$EXEMPT_NAME" --argjson source "$EXEMPT_SOURCE" \
+ --slurpfile base "$CACHE_DIR/base.json" \
+ '[.[] | select(.name == $name and .source == $source)
+ | . as $e
+ | select([$base[0].plugins[] | select(.name == $name)
+ | .source.sha = $source.sha] == [$e])]' \
+ "$CACHE_DIR/changed.json" > "$CACHE_DIR/exempt.json"
+ fi
+ exempt_count="$(jq 'length' "$CACHE_DIR/exempt.json")"
+ if [[ "$exempt_count" != "0" ]]; then
+ echo "::warning::NOT SCANNED: $EXEMPT_NAME is exempt from the policy scan at this commit. See EXEMPT_SOURCE in scan-plugins.yml."
+ fi
+
# Split changed entries into cached vs uncached. A hit requires the
# *whole* source object (repo, sha, path, ref) to match the cached
# entry, not just name@sha — a repo migration or path change with the
# same SHA is different scan content and must miss the cache.
jq -c -s \
- '.[0] as $cache
- | (.[1] | map(. + {key: (.name + "@" + (.source.sha // "")) })) as $entries
+ '.[0] as $cache | .[2] as $exempt
+ | (.[1] - $exempt | map(. + {key: (.name + "@" + (.source.sha // "")) })) as $entries
| {
to_scan: [$entries[] | select(($cache[.key].source // null) != .source)],
cached: [$entries[] | select(($cache[.key].source // null) == .source)
| . + {verdict: $cache[.key]}]
}' \
- "$CACHE_DIR/verdicts.json" "$CACHE_DIR/changed.json" > "$CACHE_DIR/split.json"
+ "$CACHE_DIR/verdicts.json" "$CACHE_DIR/changed.json" "$CACHE_DIR/exempt.json" > "$CACHE_DIR/split.json"
jq -c '.to_scan' "$CACHE_DIR/split.json" > "$CACHE_DIR/to-scan.json"
jq -c '.cached' "$CACHE_DIR/split.json" > "$CACHE_DIR/cached.json"
@@ -227,12 +257,13 @@ jobs:
{
echo "changed=$changed_count"
+ echo "exempt=$exempt_count"
echo "to_scan=$to_scan_count"
echo "cached=$cached_count"
echo "cached_failures=$cached_fail_count"
} >> "$GITHUB_OUTPUT"
- echo "::notice::$changed_count changed entrie(s): $cached_count cached ($cached_fail_count failing), $to_scan_count to scan."
+ echo "::notice::$changed_count changed entrie(s): $cached_count cached ($cached_fail_count failing), $to_scan_count to scan, $exempt_count exempt."
- name: Scan uncached entries
if: steps.changes.outputs.relevant == 'true' && steps.filter.outputs.to_scan != '0'
@@ -364,6 +395,7 @@ jobs:
echo
echo "Changed entries: ${total} · cached: $(jq 'length' "$CACHE_DIR/cached.json") · scanned fresh: $(jq 'length' "$CACHE_DIR/fresh.json") · failures: ${fail_count}"
echo
+ jq -r '.[] | "**NOT SCANNED (exempt):** \(.name) at `\(.source.sha)`\n"' "$CACHE_DIR/exempt.json"
if [[ "$total" -gt 0 ]]; then
echo "| Plugin | SHA | Passes | Source | Summary |"
echo "|---|---|---|---|---|"
@@ -408,6 +440,7 @@ jobs:
if: steps.changes.outputs.relevant == 'true'
env:
CHANGED: ${{ steps.filter.outputs.changed }}
+ EXEMPT: ${{ steps.filter.outputs.exempt }}
FAILED: ${{ steps.report.outputs.failed_count || '0' }}
SCAN_OUTCOME: ${{ steps.scan.outcome }}
run: |
@@ -424,10 +457,12 @@ jobs:
echo "::error::Scan step failed without a parseable policy verdict (likely an infra error)."
exit 1
fi
- # Every changed external entry needs its own passing verdict.
+ # Every changed external entry needs its own passing verdict, except
+ # the exempt one.
passed="$(jq '[.[] | select(.passes == true)] | length' "$CACHE_DIR/run-verdicts.json")"
- if [[ "$passed" != "$CHANGED" ]]; then
- echo "::error::$passed of $CHANGED changed external entries have a passing policy verdict. See the scan step log."
+ needed="$((CHANGED - EXEMPT))"
+ if [[ "$passed" != "$needed" ]]; then
+ echo "::error::$passed of $needed changed external entries have a passing policy verdict. See the scan step log."
exit 1
fi