Guide 05 / DevSecOps & CI/CD
MCP Supply-Chain Lockfiles (mcp-lock.json) & GitHub SARIF Code Scanning
Pin MCP server versions, compute SHA-256 configuration digests, and enforce line-accurate SARIF v2.1.0 security gates in GitHub Actions.
1. The npx -y Supply-Chain Attack Vector (MCP04)
Most community MCP snippets instruct users to run npx -y @org/mcp-server without a version specifier. Every time the IDE restarts, npx fetches the latest published tarball from npm, exposing every developer machine to upstream package takeover or typosquatting.
2. Generating SHA-256 Lockfiles (mcpshield lock)
Use mcpshield lock to compute deterministic SHA-256 digests over each server's normalized command, pinned arguments, and environment variable keys:
node ./bin/mcpshield.mjs lock ./mcp.hardened.json --output ./mcp-lock.json
3. Line-Accurate SARIF v2.1.0 in GitHub Security
MCPShield's AST source mapper attaches exact 1-based startLine and startColumn coordinates to every SARIF result so pull-request annotations appear directly on the offending JSON property:
node ./bin/mcpshield.mjs scan ./mcp.json --sarif ./mcpshield-results.sarif.json --fail-on high
Audit Your Configuration Now: Paste your
mcp.json into the 100% Client-Side MCPShield Browser Workbench or license the Offline Pro CLI & EU AI Act Annex IV Compliance Suite on Polar.sh.