mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-06-28 07:13:28 +00:00
Compare commits
2 Commits
add-cloud-
...
zenexer/sc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07fedac665 | ||
|
|
7a69e2cdb4 |
43
.github/workflows/scan-plugins.yml
vendored
43
.github/workflows/scan-plugins.yml
vendored
@@ -32,6 +32,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
id-token: write # Anthropic Workload Identity Federation (scan-plugins action)
|
||||||
|
|
||||||
# Serialize scans per ref so concurrent runs (a re-dispatch racing the
|
# Serialize scans per ref so concurrent runs (a re-dispatch racing the
|
||||||
# original, or a manual dispatch) don't both restore the same cache, scan
|
# original, or a manual dispatch) don't both restore the same cache, scan
|
||||||
@@ -76,18 +77,11 @@ jobs:
|
|||||||
echo "relevant=true" >> "$GITHUB_OUTPUT"
|
echo "relevant=true" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The shared action no-ops gracefully when ANTHROPIC_API_KEY is unset
|
# Auth: the shared scan-plugins action below uses Workload Identity
|
||||||
# (sensible default for community repos). Here `scan` is a required
|
# Federation (anthropic-federation-rule-id input) — the IDs are literal
|
||||||
# check, so a silent no-op would make it a rubber stamp — fail closed.
|
# in this file, so the action's "skip if no auth" path can't trigger.
|
||||||
- name: Require ANTHROPIC_API_KEY when a scan is needed
|
# The previous "Require ANTHROPIC_API_KEY" fail-closed guard is
|
||||||
if: steps.changes.outputs.relevant == 'true'
|
# therefore no longer needed.
|
||||||
env:
|
|
||||||
API_KEY_SET: ${{ secrets.ANTHROPIC_API_KEY != '' }}
|
|
||||||
run: |
|
|
||||||
if [[ "$API_KEY_SET" != "true" ]]; then
|
|
||||||
echo "::error::ANTHROPIC_API_KEY is not configured; refusing to skip a required policy scan."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verdict cache, keyed on the policy content hash. A prompt change
|
# Verdict cache, keyed on the policy content hash. A prompt change
|
||||||
# invalidates every cached verdict — that is intentional. The save key
|
# invalidates every cached verdict — that is intentional. The save key
|
||||||
@@ -200,9 +194,17 @@ jobs:
|
|||||||
# The verdict (cached + fresh) is what gates the job, not the action's
|
# The verdict (cached + fresh) is what gates the job, not the action's
|
||||||
# exit code, and the revert workflow needs the artifact even on failure.
|
# exit code, and the revert workflow needs the artifact even on failure.
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: anthropics/claude-plugins-community/.github/actions/scan-plugins@b277757588871fe55b2620de8c6dfda470e2e9d8
|
# Pinned to claude-plugins-community#34 (WIF input support).
|
||||||
|
# TODO: re-pin to a main-branch SHA once #34 merges.
|
||||||
|
uses: anthropics/claude-plugins-community/.github/actions/scan-plugins@e85f0d65b4fc87f07862e1dcdc467950514414ec
|
||||||
with:
|
with:
|
||||||
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
# Anthropic auth via Workload Identity Federation — the action
|
||||||
|
# mints a GitHub OIDC token (id-token: write above) and the claude
|
||||||
|
# CLI exchanges it for a short-lived bearer. The federation rule is
|
||||||
|
# bound to this repository (repository_id-pinned).
|
||||||
|
anthropic-federation-rule-id: fdrl_0147kJdru6bZKTtzwFNEqsDf
|
||||||
|
anthropic-organization-id: 1ec12c5c-6542-4da8-bf2f-c15919aef01c
|
||||||
|
anthropic-service-account-id: svac_01DnC3BtPHGjYJEGeuUUXZ8v
|
||||||
marketplace-path: .scan-cache/scan-targets.json
|
marketplace-path: .scan-cache/scan-targets.json
|
||||||
policy-prompt: .github/policy/prompt.md
|
policy-prompt: .github/policy/prompt.md
|
||||||
fail-on-findings: "true"
|
fail-on-findings: "true"
|
||||||
@@ -241,12 +243,13 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Defense in depth: the scan action runs Claude with Read access over
|
# Defense in depth: the scan action runs Claude with Read access over
|
||||||
# a cloned external repo and ANTHROPIC_API_KEY in its process env. A
|
# a cloned external repo. With WIF auth the process env carries a
|
||||||
# successful prompt injection could coerce the model to put key
|
# short-lived OIDC JWT (masked) and the CLI's exchanged bearer
|
||||||
# material into `summary`/`violations`. The action's own step summary
|
# rather than a long-lived sk-ant- key, which bounds the blast
|
||||||
# already carries that risk; this workflow adds an artifact and a PR
|
# radius of a prompt-injection exfil to a token that expires in
|
||||||
# comment, both public sinks. Scrub any key-shaped token here so it
|
# minutes. The sk-ant- scrubber stays as defense-in-depth (covers
|
||||||
# never reaches the cache, artifact, or comment.
|
# any future static-key fallback) so key-shaped strings still never
|
||||||
|
# reach the cache, artifact, or PR comment.
|
||||||
jq -c '(.. | strings) |= gsub("sk-ant-[A-Za-z0-9_-]{8,}"; "[REDACTED]")' \
|
jq -c '(.. | strings) |= gsub("sk-ant-[A-Za-z0-9_-]{8,}"; "[REDACTED]")' \
|
||||||
"$CACHE_DIR/scanned-raw.json" > "$CACHE_DIR/scanned-raw.json.tmp"
|
"$CACHE_DIR/scanned-raw.json" > "$CACHE_DIR/scanned-raw.json.tmp"
|
||||||
mv "$CACHE_DIR/scanned-raw.json.tmp" "$CACHE_DIR/scanned-raw.json"
|
mv "$CACHE_DIR/scanned-raw.json.tmp" "$CACHE_DIR/scanned-raw.json"
|
||||||
|
|||||||
Reference in New Issue
Block a user