supply-chain-attack-response
Detect, respond to, and prevent software supply chain attacks on package registries, container images, and CI/CD pipelines with lockfile auditing, provenance verification, and emergency response playbooks.
What this skill does
# Supply Chain Attack Response Software supply chain attacks target the dependencies, build systems, and distribution channels that developers trust implicitly. When a package on PyPI, npm, or crates.io is compromised, every downstream consumer inherits the malicious payload. This skill provides detection techniques, emergency response playbooks, and hardening strategies to protect your software supply chain end to end. --- ## 1. When to Use This Skill Invoke this skill when any of the following apply: - A dependency you consume has been flagged as compromised (e.g., advisories on OSV.dev, GitHub Advisory Database, or vendor disclosure). - You observe suspicious behavior from a dependency: unexpected network calls, file system writes outside its scope, or new post-install scripts. - You are conducting a periodic supply chain security audit. - A CI/CD pipeline is behaving unexpectedly after a dependency update. - You are onboarding a new third-party dependency and want to verify its provenance. - You need to respond to an incident such as a typosquatted package or registry account takeover. - You are implementing SLSA compliance or need to generate build provenance. --- ## 2. Detection ### 2.1 npm Audit ```bash # Full audit of installed packages npm audit # JSON output for programmatic processing npm audit --json | jq '.vulnerabilities | to_entries[] | select(.value.severity == "critical")' # Fix automatically where possible npm audit fix # Check for known malicious packages via Socket.dev CLI npx socket scan --package-lock package-lock.json ``` ### 2.2 pip Audit ```bash # Install pip-audit (maintained by Google/OSSF) pip install pip-audit # Audit current environment against OSV.dev pip-audit # Audit a requirements file directly pip-audit -r requirements.txt --output json # Check for typosquatting with bandersnatch or custom script pip-audit --strict --desc on ``` ### 2.3 Cargo Audit ```bash # Install cargo-audit cargo install cargo-audit # Run audit against RustSec Advisory Database cargo audit # JSON output for CI integration cargo audit --json # Check for yanked crates cargo audit --deny yanked ``` ### 2.4 Sigstore / Cosign Verification ```bash # Verify a container image signature with cosign cosign verify \ --certificate-identity "https://github.com/myorg/myrepo/.github/workflows/build.yml@refs/heads/main" \ --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \ ghcr.io/myorg/myimage:latest # Verify an artifact with sigstore-python pip install sigstore python -m sigstore verify identity \ --cert-identity "[email protected]" \ --cert-oidc-issuer "https://accounts.google.com" \ artifact.tar.gz ``` ### 2.5 SLSA Provenance Checks ```bash # Install slsa-verifier go install github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier@latest # Verify provenance of a binary slsa-verifier verify-artifact my-binary \ --provenance-path my-binary.intoto.jsonl \ --source-uri github.com/myorg/myrepo \ --source-tag v1.2.3 ``` --- ## 3. Emergency Response Playbook When a dependency is confirmed compromised, execute these steps in order. ### Step 1: Contain -- Pin and Freeze ```bash # Pin the last known-good version immediately in package.json npm install <package>@<safe-version> --save-exact # For pip, pin with hash verification pip download <package>==<safe-version> --require-hashes -d ./vendor/ # For cargo, pin in Cargo.toml # Replace: some_crate = "^1.2" with: # some_crate = "=1.2.3" cargo update -p some_crate --precise 1.2.3 ``` ### Step 2: Audit Exposure ```bash # Determine which versions you pulled and when # npm npm ls <compromised-package> cat package-lock.json | jq '.packages | to_entries[] | select(.key | contains("<compromised-package>"))' # pip pip show <compromised-package> pip cache list <compromised-package> # Check git history for when the dependency version changed git log --all -p -- package-lock.json | grep -A2 -B2 "<compromised-package>" ``` ### Step 3: Scan for Indicators of Compromise ```bash # Search for known IOCs from the advisory grep -r "suspicious-domain.com" ./node_modules/<compromised-package>/ grep -r "eval(atob" ./node_modules/<compromised-package>/ # Check for unexpected post-install scripts cat node_modules/<compromised-package>/package.json | jq '.scripts' # For Python packages, inspect setup.py and __init__.py find ~/.local/lib/python*/site-packages/<compromised-package>/ -name "*.py" \ | xargs grep -l "subprocess\|os.system\|exec(\|eval(" ``` ### Step 4: Notify Stakeholders ```text SUBJECT: [SECURITY INCIDENT] Compromised dependency: <package-name> SEVERITY: Critical IMPACT: <package-name> versions <affected-range> contain malicious code. AFFECTED SYSTEMS: <list of repos/services consuming this dependency> STATUS: Contained -- pinned to safe version <safe-version> ACTIONS TAKEN: 1. Pinned all repositories to last known-good version 2. Initiated audit of all systems that pulled affected versions 3. Scanning for indicators of compromise RECOMMENDED ACTIONS: - Do NOT deploy any build that consumed affected versions - Review CI/CD logs for the timeframe <start> to <end> - Rotate any secrets that were accessible to the build environment ``` ### Step 5: Replace or Fork ```bash # If the package maintainer account was compromised, fork the last safe version git clone https://github.com/original-author/<package>.git cd <package> git checkout v<safe-version> # Publish to your private registry or vendor directly # For npm, point to your fork via package.json # "dependencies": { "<package>": "git+https://github.com/yourorg/<package>.git#v1.2.3" } ``` --- ## 4. Lockfile Auditing Lockfiles are your first line of defense. Tampered or inconsistent lockfiles indicate something is wrong. ### 4.1 Verify Lockfile Integrity ```bash # npm: ensure lockfile matches package.json (fails CI if out of sync) npm ci # Yarn: check lockfile integrity yarn install --frozen-lockfile # pip: generate a hash-locked requirements file pip-compile --generate-hashes requirements.in -o requirements.txt # Verify no unexpected changes in lockfile during PR git diff --name-only origin/main...HEAD | grep -E "(package-lock|yarn.lock|Cargo.lock|requirements.txt)" ``` ### 4.2 Detect Typosquatting ```bash # Use the socket CLI to check for typosquatting risk npx socket scan --package-lock package-lock.json # Python: check package names against popular packages pip-audit -r requirements.txt 2>&1 | grep -i "typosquat" # Custom check: compare package names to known popular packages # Flag anything with edit distance <= 2 from a top-1000 package python3 -c " import json, sys from difflib import SequenceMatcher with open('package-lock.json') as f: lock = json.load(f) popular = ['express','lodash','react','axios','chalk','debug','commander','inquirer'] for pkg in lock.get('packages', {}): name = pkg.split('node_modules/')[-1] if 'node_modules/' in pkg else pkg for p in popular: ratio = SequenceMatcher(None, name, p).ratio() if 0.75 < ratio < 1.0 and name != p: print(f'WARNING: {name} is suspiciously similar to {p} (similarity: {ratio:.2f})') " ``` ### 4.3 Lockfile Diff in CI ```yaml # .github/workflows/lockfile-check.yml name: Lockfile Audit on: pull_request jobs: audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check for lockfile changes run: | LOCKFILES="package-lock.json yarn.lock pnpm-lock.yaml Cargo.lock requirements.txt poetry.lock" for f in $LOCKFILES; do if git diff --name-only origin/main...HEAD | grep -q "$f"; then echo "::warning::Lockfile $f was modified -- review dependency changes carefully" git diff origin/main...HEAD -- "$f" | head -100 fi done - name: Run npm audit if: hashFiles('package-lock.json') != '' run: npm audit --audi
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.