threat-intel: 6 MCP/AI-relevant OSV-confirmed malicious package(s) for review #382
Workflow file for this run
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
| name: Security | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| schedule: | |
| # Run every Monday at 08:00 UTC | |
| - cron: "0 8 * * 1" | |
| permissions: | |
| contents: read | |
| security-events: write # needed to upload SARIF results to GitHub Security tab | |
| jobs: | |
| source: | |
| name: Prepare Source Tree | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Package source tree | |
| run: tar --exclude='.git' -czf /tmp/source-tree.tar.gz . | |
| - name: Upload source tree | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: source-tree | |
| path: /tmp/source-tree.tar.gz | |
| retention-days: 1 | |
| # ── 1. Go vulnerability scan (govulncheck) ──────────────────────────────── | |
| govulncheck: | |
| name: Go Vulnerability Check | |
| runs-on: ubuntu-latest | |
| needs: [source] | |
| steps: | |
| - name: Download source tree | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: source-tree | |
| path: /tmp/source | |
| - name: Extract source tree | |
| run: tar -xzf /tmp/source/source-tree.tar.gz -C "$GITHUB_WORKSPACE" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.4" | |
| cache: true | |
| - name: Install govulncheck | |
| run: go install golang.org/x/vuln/cmd/govulncheck@latest | |
| - name: Run govulncheck | |
| run: govulncheck ./... | |
| # ── 2. Static security analysis (gosec) ────────────────────────────────── | |
| gosec: | |
| name: GoSec Static Analysis | |
| runs-on: ubuntu-latest | |
| needs: [source] | |
| steps: | |
| - name: Download source tree | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: source-tree | |
| path: /tmp/source | |
| - name: Extract source tree | |
| run: tar -xzf /tmp/source/source-tree.tar.gz -C "$GITHUB_WORKSPACE" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.4" | |
| cache: true | |
| - name: Run gosec | |
| uses: securego/gosec@master | |
| continue-on-error: true # findings upload to Security tab; don't block CI | |
| with: | |
| # G304 (file path from CLI flag) is intentional behaviour in a CLI tool. | |
| # Results are reviewed via the SARIF upload to the GitHub Security tab. | |
| args: >- | |
| -fmt sarif | |
| -out gosec-results.sarif | |
| -severity medium | |
| -exclude-dir dist | |
| ./... | |
| - name: Upload SARIF results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: gosec-results.sarif | |
| # ── 3. Dependency review on PRs ─────────────────────────────────────────── | |
| dependency-review: | |
| name: Dependency Review | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| needs: [source] | |
| steps: | |
| - name: Download source tree | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: source-tree | |
| path: /tmp/source | |
| - name: Extract source tree | |
| run: tar -xzf /tmp/source/source-tree.tar.gz -C "$GITHUB_WORKSPACE" | |
| - uses: actions/dependency-review-action@v4 | |
| continue-on-error: true # requires Dependency Graph enabled in repo settings | |
| with: | |
| fail-on-severity: high | |
| # ── 4. ToolTrust Scanner scans its own MCP tool fixtures (meta-scan) ──────── | |
| meta-scan: | |
| name: ToolTrust Meta-Scan | |
| runs-on: ubuntu-latest | |
| needs: [source] | |
| steps: | |
| - name: Download source tree | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: source-tree | |
| path: /tmp/source | |
| - name: Extract source tree | |
| run: tar -xzf /tmp/source/source-tree.tar.gz -C "$GITHUB_WORKSPACE" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.4" | |
| cache: true | |
| - name: Build tooltrust-scanner | |
| run: go build -o /tmp/tooltrust-scanner ./cmd/tooltrust-scanner/ | |
| - name: Run meta-scan against project's MCP tool fixtures | |
| run: | | |
| if [ -f testdata/tools.json ]; then | |
| /tmp/tooltrust-scanner scan --protocol mcp --input testdata/tools.json --output json --file /tmp/meta_scan.json | |
| else | |
| echo '{"tools":[]}' > /tmp/empty.json | |
| /tmp/tooltrust-scanner scan --protocol mcp --input /tmp/empty.json --output json --file /tmp/meta_scan.json | |
| fi | |
| cat /tmp/meta_scan.json | |
| - name: Fail on BLOCKED tools | |
| run: | | |
| BLOCKED=$(jq '.summary.blocked // 0' /tmp/meta_scan.json) | |
| if [ "$BLOCKED" -gt "0" ]; then | |
| echo "Meta-scan detected $BLOCKED BLOCKED tool(s)." | |
| exit 1 | |
| fi | |
| echo "Meta-scan passed — no blocked tools." | |
| - name: Upload meta-scan report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: meta-scan-report | |
| path: /tmp/meta_scan.json | |
| retention-days: 30 |