Repository navigation
feat(security) : Add extension catalog submission guidelines and security scans #9937
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
Closed
Abhijay007
wants to merge
5
commits into
aaif-goose:main
from
Abhijay007:extension-catalog-security-scanning
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b01915b
docs: add extension submission guidelines
Abhijay007 0f6028f
test: validate extension catalog entries
Abhijay007 0696b9a
ci: scan extension submissions for security risks
Abhijay007 f00eb9f
ci: audit extension catalog periodically
Abhijay007 c842be7
fix: fixed a few things
Abhijay007 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,48 @@ | ||
| ## New extension submission | ||
|
|
||
| <!-- | ||
| Use this template when adding an MCP server to the goose extension catalog | ||
| (documentation/static/servers.json + a docs/mcp/ tutorial page). | ||
|
|
||
| Full criteria: https://goose-docs.ai/docs/mcp/contributing | ||
| Narrow/personal servers don't need to be in the catalog - they can be added | ||
| locally as a custom extension instead. | ||
| --> | ||
|
|
||
| **Extension name:** | ||
| **Source / repo:** | ||
| **Maintainer (you / the vendor / community):** | ||
|
|
||
| ### Summary | ||
| <!-- What does this extension do and who is it useful for? --> | ||
|
|
||
| ### Provenance & trust | ||
| - [ ] Source is open and inspectable (or closed/remote status is clearly noted) | ||
| - [ ] Official vendor integration, or clearly marked as a community reimplementation | ||
| - [ ] Repo is actively maintained (recent commits, real releases) | ||
|
|
||
| ### Security | ||
| - [ ] Uses OAuth / scoped tokens where possible (not long-lived keys) | ||
| - [ ] Secrets come from env vars / keychain, **never** inlined in `goose://` links or examples | ||
| - [ ] Requests least-privilege scopes | ||
| - [ ] Destructive or money-spending tools are documented | ||
| - [ ] Data egress / privacy is documented (for remote servers) | ||
|
|
||
| ### Quality | ||
| - [ ] Tutorial page based on `_template_.mdx` | ||
| - [ ] Install verified on **goose Desktop** | ||
| - [ ] Install verified on **goose CLI** | ||
| - [ ] Tool surface is focused (not dozens of unrelated tools) | ||
|
|
||
| ### Transparency (if commercial) | ||
| - [ ] Pricing is disclosed (free / paid / freemium) | ||
| - [ ] A sandbox or test mode exists, or limitations are stated | ||
| - [ ] License / commercial terms are clear | ||
|
|
||
| ### Catalog entry | ||
| - [ ] `servers.json` entry added with required fields | ||
| - [ ] `npm run validate:servers` passes locally | ||
| - [ ] Automated security scan reviewed (will run on this PR) | ||
|
|
||
| ### Related issues / discussion | ||
| Relates to #ISSUE_ID |
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,151 @@ | ||
| name: Extension Catalog Audit | ||
|
|
||
| # Periodically re-scans every extension in the catalog. Extensions go stale, | ||
| # change behavior, or get hijacked after they're merged, so a one-time gate at | ||
| # submission isn't enough. Findings are surfaced as a tracking issue. | ||
| # | ||
| # Unlike the submission gate, this runs over already-merged (trusted) catalog | ||
| # entries on the default branch, so richer analyzers can be enabled via repo | ||
| # variables/secrets. | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 6 * * 1' # Mondays 06:00 UTC | ||
| workflow_dispatch: | ||
| inputs: | ||
| analyzers: | ||
| description: 'mcp-scanner analyzers (comma-separated)' | ||
| required: false | ||
| default: 'yara' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: extension-catalog-audit | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| ANALYZERS: ${{ github.event.inputs.analyzers || vars.EXTENSION_AUDIT_ANALYZERS || 'yara' }} | ||
| BLOCK_SEVERITY: ${{ vars.EXTENSION_AUDIT_BLOCK_SEVERITY || 'MEDIUM' }} | ||
|
|
||
| jobs: | ||
| audit: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 120 | ||
| steps: | ||
| - name: Harden Runner | ||
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
|
|
||
| - name: Install MCP scanner | ||
| run: uv tool install --python 3.13 cisco-ai-mcp-scanner | ||
|
|
||
| - name: Scan entire catalog | ||
| env: | ||
| # Optional richer analysis. Only used if the corresponding analyzer is | ||
| # named in ANALYZERS; safe to leave unset for a YARA-only audit. | ||
| MCP_SCANNER_LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| MCP_SCANNER_API_KEY: ${{ secrets.MCP_SCANNER_API_KEY }} | ||
|
Abhijay007 marked this conversation as resolved.
Resolved
|
||
| run: | | ||
| export PATH="$HOME/.local/bin:$PATH" | ||
| bash extension-scanner/scan-extensions.sh \ | ||
| documentation/static/servers.json \ | ||
| "$RUNNER_TEMP/audit" | ||
|
|
||
| - name: Upload audit results | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: extension-catalog-audit | ||
| path: ${{ runner.temp }}/audit/** | ||
| if-no-files-found: warn | ||
| retention-days: 30 | ||
|
|
||
| - name: Open or update tracking issue | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| AUDIT_DIR: ${{ runner.temp }}/audit | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const auditDir = process.env.AUDIT_DIR; | ||
| const summaryPath = path.join(auditDir, 'summary.json'); | ||
| const bodyPath = path.join(auditDir, 'summary.md'); | ||
| if (!fs.existsSync(summaryPath)) { | ||
| core.warning('No summary.json produced; skipping issue management.'); | ||
| return; | ||
| } | ||
|
|
||
| const summary = JSON.parse(fs.readFileSync(summaryPath, 'utf8')); | ||
| const body = fs.existsSync(bodyPath) | ||
| ? fs.readFileSync(bodyPath, 'utf8') | ||
| : 'Audit completed.'; | ||
|
|
||
| const needsAttention = | ||
| summary.overall_status === 'BLOCKED' || summary.inconclusive > 0; | ||
|
|
||
| const LABEL = 'extension-security'; | ||
| const TITLE = 'Extension catalog security audit'; | ||
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | ||
| const issueBody = `${body}\n\n[Full audit run](${runUrl})`; | ||
|
|
||
| // Ensure the label exists. | ||
| try { | ||
| await github.rest.issues.getLabel({ | ||
| owner: context.repo.owner, repo: context.repo.repo, name: LABEL, | ||
| }); | ||
| } catch (e) { | ||
| await github.rest.issues.createLabel({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| name: LABEL, color: 'b60205', | ||
| description: 'Security findings in catalog extensions', | ||
| }); | ||
| } | ||
|
|
||
| const { data: open } = await github.rest.issues.listForRepo({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| labels: LABEL, state: 'open', | ||
| }); | ||
| const existing = open.find(i => i.title === TITLE); | ||
|
|
||
| if (needsAttention) { | ||
| if (existing) { | ||
| await github.rest.issues.update({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| issue_number: existing.number, body: issueBody, state: 'open', | ||
| }); | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| issue_number: existing.number, | ||
| body: `Re-audited: still needs attention (${summary.blocked} blocked, ${summary.inconclusive} inconclusive).`, | ||
| }); | ||
| } else { | ||
| await github.rest.issues.create({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| title: TITLE, body: issueBody, labels: [LABEL], | ||
| }); | ||
| } | ||
| core.setFailed(`Catalog audit needs attention: ${summary.blocked} blocked, ${summary.inconclusive} inconclusive.`); | ||
| } else if (existing) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| issue_number: existing.number, | ||
| body: 'Latest audit is clean. Closing.', | ||
| }); | ||
| await github.rest.issues.update({ | ||
| owner: context.repo.owner, repo: context.repo.repo, | ||
| issue_number: existing.number, state: 'closed', | ||
| }); | ||
| } else { | ||
| core.info('Catalog audit clean; no open issue to manage.'); | ||
| } | ||
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,46 @@ | ||
| name: Validate Extension Catalog | ||
|
|
||
| # Structural validation of the extension catalog (documentation/static/servers.json). | ||
| # Read-only and dependency-free, so it runs safely on fork PRs without secrets. | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'documentation/static/servers.json' | ||
| - 'documentation/static/servers.schema.json' | ||
| - 'documentation/scripts/validate-servers.js' | ||
| - 'documentation/scripts/validate-servers.test.js' | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'documentation/static/servers.json' | ||
| - 'documentation/static/servers.schema.json' | ||
| - 'documentation/scripts/validate-servers.js' | ||
| - 'documentation/scripts/validate-servers.test.js' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: validate-catalog-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 20 | ||
|
|
||
| - name: Validate servers.json | ||
| working-directory: ./documentation | ||
| run: node scripts/validate-servers.js | ||
|
|
||
| - name: Run validator unit tests | ||
| working-directory: ./documentation | ||
| run: node --test scripts/validate-servers.test.js |
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,89 @@ | ||
| name: Extension Security Scan Report | ||
|
|
||
| # Posts the results of "Extension Security Scan" back to the PR. Runs in the | ||
| # trusted workflow_run context so it has write access, while the scan itself | ||
| # (which executes untrusted server code) runs without secrets. | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Extension Security Scan"] | ||
| types: [completed] | ||
|
|
||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| issues: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| report: | ||
| runs-on: ubuntu-latest | ||
| if: github.event.workflow_run.event == 'pull_request' | ||
| steps: | ||
| - name: Download scan artifact and comment | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| const os = require('os'); | ||
| const path = require('path'); | ||
|
|
||
| const runId = context.payload.workflow_run.id; | ||
| const { data: artifacts } = await github.rest.actions.listWorkflowRunArtifacts({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| run_id: runId, | ||
| }); | ||
|
|
||
| const artifact = artifacts.artifacts.find(a => a.name === 'extension-scan-results'); | ||
| if (!artifact) { | ||
| core.info('No extension-scan-results artifact; nothing to report.'); | ||
| return; | ||
| } | ||
|
|
||
| const zip = await github.rest.actions.downloadArtifact({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| artifact_id: artifact.id, | ||
| archive_format: 'zip', | ||
| }); | ||
|
|
||
| const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'scan-')); | ||
| const zipPath = path.join(tmp, 'artifact.zip'); | ||
| fs.writeFileSync(zipPath, Buffer.from(zip.data)); | ||
| require('child_process').execFileSync('unzip', ['-o', zipPath, '-d', tmp]); | ||
|
|
||
| const prNumberPath = path.join(tmp, 'pr_number.txt'); | ||
| const summaryPath = path.join(tmp, 'summary.md'); | ||
| if (!fs.existsSync(prNumberPath) || !fs.existsSync(summaryPath)) { | ||
| core.info('Artifact missing pr_number.txt or summary.md; skipping.'); | ||
| return; | ||
| } | ||
|
|
||
| const prNumber = parseInt(fs.readFileSync(prNumberPath, 'utf8').trim(), 10); | ||
| const body = fs.readFileSync(summaryPath, 'utf8'); | ||
| const marker = '<!-- extension-security-scan -->'; | ||
| const commentBody = `${marker}\n${body}`; | ||
|
|
||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| }); | ||
| const existing = comments.find(c => c.body && c.body.includes(marker)); | ||
|
|
||
| if (existing) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: existing.id, | ||
| body: commentBody, | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| body: commentBody, | ||
| }); | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the scheduled audit,
actions/checkoutkeeps the job token in the local git config by default (the checkout action documents that the auth token is persisted unlesspersist-credentials: falseis set), and this same job later launches catalog stdio servers while holdingissues: write. If a merged catalog package is hijacked or malicious, it can read and exfiltrate that persistedGITHUB_TOKENduring the scan and use it to write issues/comments until it expires; setpersist-credentials: falsefor checkout or split the untrusted scan from the issue-updating job.Useful? React with 👍 / 👎.