Repository navigation
ci: scan skills with SkillSpector and the skill text audit #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
glebedel
wants to merge
6
commits into
main
Choose a base branch
from
feat/skill-security-scans
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,971
−0
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0732f29
ci: scan skills with SkillSpector and the skill text audit
s2d2-s1 c46ea14
ci: vendor the skill text audit at powerful-plugins 7c362c5
s2d2-s1 422b88e
ci: vendor the skill text audit at powerful-plugins 260e0eb
s2d2-s1 76cace4
ci: vendor the skill text audit at powerful-plugins 1aa2847
s2d2-s1 ed39462
ci: bump SkillSpector's pydantic and truststore, scan Antigravity plu…
s2d2-s1 35cc8f6
ci: restore the zstandard hashes dropped from the SkillSpector lock
s2d2-s1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # SkillSpector's build backend, installed first so scan-skills can build it with | ||
| # --no-build-isolation instead of letting pip fetch hatchling unpinned. Regenerate with: | ||
| # echo hatchling | uv pip compile - --universal --python-version 3.12 --generate-hashes \ | ||
| # --no-header --no-annotate -o .github/skillspector/build-requirements.txt | ||
| hatchling==1.32.4 \ | ||
| --hash=sha256:08ecf7548fb48205e7f213d70c71e67b8271b7242093dc3f1da578b42c734a2c \ | ||
| --hash=sha256:c4468f73144c054d2aab4ef0f0378c43b9878bf07f8ffd6b79690e970d375f07 | ||
| packaging==26.3 \ | ||
| --hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79 \ | ||
| --hash=sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c | ||
| pathspec==1.1.1 \ | ||
| --hash=sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a \ | ||
| --hash=sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189 | ||
| pluggy==1.6.0 \ | ||
| --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ | ||
| --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 | ||
| tomlkit==0.15.1 \ | ||
| --hash=sha256:177a05aece5a8ca5266fd3c448abb47b8d352f09d477d3ca8332db4d89b24304 \ | ||
| --hash=sha256:e25bbf38843005246210a12982776f27f99cb9be67160e14434d0c0d21ee1e97 | ||
| trove-classifiers==2026.9.21.13 \ | ||
| --hash=sha256:0a9ebc8d4e2f3e8a22848c5258033035bec17a3012ac3fea16dbaa764489eb71 \ | ||
| --hash=sha256:8b1ff4f9c191b1040b71c37f1e445ab99732911e3cd91de52838453a854d7a17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # SkillSpector's runtime dependencies, copied from its pyproject.toml at the pinned commit, | ||
| # minus langgraph-cli[inmem]. That one only serves SkillSpector's own `make langgraph-dev` | ||
| # (LangGraph Studio): the scanner never imports it, and it brings in ~40 packages, among | ||
| # them a web server, grpcio and jsonschema-rs, that the scan never loads. With it removed, | ||
| # a full scan of this repository gives the same findings. | ||
| # | ||
| # To bump SkillSpector: update this list from its pyproject.toml (still leaving out | ||
| # langgraph-cli), then regenerate requirements.txt as its header says. | ||
| typer>=0.23.0,<0.24 | ||
| rich>=14.3.0 | ||
| httpx>=0.28.0 | ||
| pyyaml>=6.0.1 | ||
| pydantic>=2.12.0 | ||
| openai>=2.25.0 | ||
| langgraph>=1.2.14 | ||
| langchain-core>=1.2.17 | ||
| langchain-openai>=1.1.10 | ||
| langsmith>=0.7.30 | ||
| yara-python>=4.5.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| name: Scan Skills (SkillSpector) | ||
|
|
||
| # Security-scan Claude skills with NVIDIA SkillSpector. | ||
| # - pull request: scan skills changed vs main; FAIL on high risk | ||
| # - push to main (merge): scan every skill; report-only (uploads SARIF) | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: scan-skills-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| scan-skills: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| actions: read # required by upload-sarif in private repositories | ||
| contents: read | ||
| security-events: write # required to upload SARIF to code scanning | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 0 # full history so we can diff against main | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install SkillSpector | ||
| # SkillSpector and everything it needs to scan are pinned with hashes in | ||
| # .github/skillspector/, which says how to bump them. --no-deps because that file is a | ||
| # closed set that leaves out SkillSpector's dev-server dependency (requirements.in says | ||
| # why). Its build backend goes in first, so the build fetches nothing unpinned. | ||
| run: | | ||
| python -m pip install --require-hashes -r .github/skillspector/build-requirements.txt | ||
| python -m pip install --require-hashes --no-deps --no-build-isolation \ | ||
| -r .github/skillspector/requirements.txt | ||
|
|
||
| - name: Determine scan mode | ||
| id: mode | ||
| run: | | ||
| if [ "$GITHUB_REF" = "refs/heads/main" ]; then | ||
| echo "mode=all" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "mode=changed" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Fetch base branch | ||
| if: steps.mode.outputs.mode == 'changed' | ||
| run: git fetch origin main:refs/remotes/origin/main | ||
|
|
||
| - name: Scan skills | ||
| env: | ||
| SKILL_ROOTS: plugins | ||
| run: | | ||
| if [ "${{ steps.mode.outputs.mode }}" = "all" ]; then | ||
| # Full scan on merge to main: report findings, but don't block. | ||
| REPORT_ONLY=1 scripts/scan-skills.sh all | ||
| else | ||
| # Branch / PR: enforce that changed skills are not high-risk. | ||
| scripts/scan-skills.sh changed origin/main | ||
| fi | ||
|
|
||
| - name: Upload SARIF reports (artifact) | ||
| if: always() | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: | ||
| name: skillspector-sarif | ||
| path: skillspector-reports/ | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Check code scanning availability | ||
| id: code-scanning | ||
| if: >- | ||
| always() && | ||
| hashFiles('skillspector-reports/skillspector.sarif') != '' && | ||
| (github.event_name != 'pull_request' || | ||
| github.event.pull_request.head.repo.full_name == github.repository) | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| # Code scanning is always available on public repositories; private ones need Code Security. | ||
| if status="$(gh api "repos/$GITHUB_REPOSITORY" --jq 'if .visibility == "public" then "enabled" else (.security_and_analysis.code_security.status // .security_and_analysis.advanced_security.status // "disabled") end')"; then | ||
| echo "Code Security status: $status" | ||
| else | ||
| echo "::warning::Could not determine Code Security status; preserving SARIF as an artifact only." | ||
| status="disabled" | ||
| fi | ||
|
|
||
| if [ "$status" = "enabled" ]; then | ||
| echo "enabled=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "enabled=false" >> "$GITHUB_OUTPUT" | ||
| echo "Code scanning upload skipped; enable Code Security to publish SARIF findings in GitHub." | ||
| fi | ||
|
|
||
| - name: Upload SARIF to code scanning | ||
| # When Code Security is enabled, a real upload failure fails the check. | ||
| # Fork PRs and private repositories without Code Security retain the artifact. | ||
| if: always() && steps.code-scanning.outputs.enabled == 'true' | ||
| uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 | ||
| with: | ||
| sarif_file: skillspector-reports/skillspector.sarif | ||
| category: skillspector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,10 +17,42 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Validate plugin manifests | ||
| run: npx --yes @anthropic-ai/[email protected] plugin validate . | ||
|
|
||
| skill-text-audit: | ||
| name: Audit skill instructions | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| # The audit diffs a pull request against the merge base, which a shallow clone lacks. | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Check the vendored skill text audit | ||
| # scripts/audit_skill_text.py is StackOneHQ/powerful-plugins' file at the commit in | ||
| # scripts/audit_skill_text.pin, so a local edit fails here; change it there, then bump both. | ||
| run: | | ||
| pin="$(cat scripts/audit_skill_text.pin)" | ||
| if ! [[ "$pin" =~ ^[0-9a-f]{40}$ ]]; then | ||
| echo "::error::scripts/audit_skill_text.pin must hold one full commit SHA" | ||
| exit 1 | ||
| fi | ||
| curl -fsSL --retry 3 --max-time 30 -o "$RUNNER_TEMP/audit_skill_text.py" \ | ||
| "https://raw.githubusercontent.com/StackOneHQ/powerful-plugins/$pin/scripts/audit_skill_text.py" | ||
| cmp "$RUNNER_TEMP/audit_skill_text.py" scripts/audit_skill_text.py | ||
|
|
||
| - name: Audit the instructions these plugins give the agent | ||
| # Guardrail evasion, pipe-to-shell and unreadable files fail; the other rules annotate the | ||
| # pull request. A pull request audits the plugins it changes; other runs audit them all. | ||
| run: >- | ||
| python3 scripts/audit_skill_text.py --catalog . --trusted-domain stackone.com | ||
| ${GITHUB_BASE_REF:+--base "origin/$GITHUB_BASE_REF"} | ||
|
|
||
| defender: | ||
| name: Test ${{ matrix.plugin }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| node_modules/ | ||
| .stackone-deps-install.lock | ||
| skillspector-reports/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| e879ed5e9c9aee60d0cb35c0d86ca9108e7af6d0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.