dependency-scanning
Scan third-party dependencies for known vulnerabilities and generate SBOMs - Snyk, Dependabot, OWASP Dependency-Check, npm/pip/go audit tools, CycloneDX/Syft - and gate CI on the results. Use when adding or tuning software-composition analysis; use dependency-upgrade to carry out the upgrades.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- dependency-scanning
- risk
- safe
- source
- https://github.com/BagelHole/DevOps-Security-Agent-Skills
- license
- MIT
- category
- security
- metadata
- { "author": "devops-skills", "version": "1.0" }
- date_added
- 2026-09-20
- description
- Scan third-party dependencies for known vulnerabilities and generate SBOMs - Snyk, Dependabot, OWASP Dependency-Check, npm/pip/go audit tools, CycloneDX/Syft - and gate CI on the results. Use when adding or tuning software-composition analysis; use dependency-upgrade to carry out the upgrades.
- source_repo
- BagelHole/DevOps-Security-Agent-Skills
- source_type
- community
- compatibility
- Requires the chosen scanner CLI (snyk, osv-scanner, dependency-check, govulncheck, syft) and access to the repository's lockfiles; Snyk needs an account token.
- license_source
- https://github.com/BagelHole/DevOps-Security-Agent-Skills/blob/main/LICENSE
03 SKILL.md 正文
Dependency Scanning
When to Use This Skill
Use when:
- Managing third-party dependencies
- Setting up software composition analysis
- Meeting compliance requirements
- Securing software supply chain
- Automating vulnerability detection
Prerequisites
- Package manifests (package.json, requirements.txt, etc.)
- CI/CD pipeline access
- Dependency scanner
Tool Comparison
| Tool | Type | Languages | Best For |
|---|---|---|---|
| Snyk | Commercial/Free | Many | Comprehensive SCA |
| Dependabot | Free (GitHub) | Many | Automated PRs |
| OWASP Dep-Check | OSS | Many | Free scanning |
| npm audit | Built-in | Node.js | Quick checks |
| pip-audit | OSS | Python | Python projects |
| Trivy | OSS | Many | Container deps |
Snyk
CLI Usage
Snyk is SaaS: scans upload dependency data to Snyk, and CLI still reports instrumentation to your Snyk org with analytics off.
# Install (pinned)
npm install -g snyk@1.1308.4
# Opt out of usage analytics (or export SNYK_DISABLE_ANALYTICS=1)
snyk config set disable-analytics=1
# Authenticate
snyk auth
# Test project
snyk test
# Monitor project (track over time)
snyk monitor
# Test specific manifest
snyk test --file=package.json
snyk test --file=requirements.txt
# Output formats
snyk test --json > snyk-results.json
snyk test --sarif > snyk-results.sarif
# Fix vulnerabilities
snyk fix
# Ignore vulnerability
snyk ignore --id=SNYK-JS-LODASH-567746 --expiry=2024-12-31 --reason="No exploit path"
CI Integration
# .github/workflows/snyk.yml
name: Snyk Security
on:
push:
branches: [main]
pull_request:
jobs:
snyk:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # required by upload-sarif
steps:
- uses: actions/checkout@v4
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@<pinned-sha> # vX.Y.Z - never a branch ref
continue-on-error: true # let the SARIF upload run even when findings fail the scan
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_DISABLE_ANALYTICS: "1"
with:
args: --severity-threshold=high --sarif-file-output=snyk.sarif
- name: Upload results to GitHub
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snyk.sarif
Policy File
# .snyk
version: v1.25.0
ignore:
SNYK-JS-LODASH-567746:
- '*':
reason: No user input reaches this function
expires: 2024-12-31
created: 2024-01-15
'snyk:lic:npm:gpl-3.0':
- '*':
reason: Internal use only
patch: {}
GitHub Dependabot
Configuration
# .github/dependabot.yml
version: 2
updates:
# JavaScript/Node.js
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 10
# Reviewer assignment: use a CODEOWNERS file (the `reviewers:` key is deprecated)
labels:
- "dependencies"
- "security"
ignore:
- dependency-name: "aws-sdk"
update-types: ["version-update:semver-major"]
groups:
development-dependencies:
dependency-type: "development"
update-types:
- "minor"
- "patch"
# Python
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
# Docker
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
Security Alerts
# Automated security updates
# Enable in repository Settings > Security > Dependabot
# Dependabot will automatically:
# - Create PRs for vulnerable dependencies
# - Update to patched versions
# - Provide CVE details in PR description
OWASP Dependency-Check
Installation
# Via Homebrew
brew install dependency-check
# Or download the latest release zip (and verify its .asc/.sha256) from
# https://github.com/dependency-check/DependencyCheck/releases
Current releases download NVD data through NVD API. Request free key; keep it out of argv: put
nvd.api.key=... in an untracked 0600 file passed with --propertyfile (Maven plugin 9.0.10+: nvdApiKeyEnvironmentVariable).
Without key, updates are very slow and may fail.
Usage
# Scan project
dependency-check --project "MyProject" \
--scan /path/to/project \
--out /path/to/reports \
--format HTML \
--format JSON
# With specific analyzers
dependency-check --project "MyProject" \
--scan . \
--enableExperimental \
--disableRetireJS
# CI configuration
dependency-check --project "MyProject" \
--scan . \
--format JSON \
--failOnCVSS 7 \
--suppression suppression.xml
Suppression File
<?xml version="1.0" encoding="UTF-8"?>
<!-- suppression.xml -->
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<suppress>
<notes>False positive - not using vulnerable function</notes>
<packageUrl regex="true">^pkg:npm/lodash@.*$</packageUrl>
<cve>CVE-2021-23337</cve>
</suppress>
<suppress until="2024-12-31">
<notes>Risk accepted - mitigated by WAF</notes>
<cpe>cpe:/a:apache:struts:2.5.0</cpe>
<vulnerabilityName>CVE-2023-12345</vulnerabilityName>
</suppress>
</suppressions>
Maven Integration
<!-- pom.xml -->
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.0.0</version>
<configuration>
<failBuildOnCVSS>7</failBuildOnCVSS>
<suppressionFiles>
<suppressionFile>suppression.xml</suppressionFile>
</suppressionFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Language-Specific Tools
Node.js (npm audit)
# Run audit
npm audit
# JSON output
npm audit --json
# Fix automatically
npm audit fix
# Fix with breaking changes
npm audit fix --force
# Production only (npm 8+; older npm used --production)
npm audit --omit=dev
Python (pip-audit)
# Install
pip install pip-audit
# Scan installed packages
pip-audit
# Scan requirements file
pip-audit -r requirements.txt
# Output formats
pip-audit --format json
pip-audit --format cyclonedx-json
# Fix vulnerabilities
pip-audit --fix
Go (govulncheck)
# Install
go install golang.org/x/vuln/cmd/govulncheck@v1.9.0
# Scan project
govulncheck ./...
# JSON output
govulncheck -json ./...
Ruby (bundler-audit)
# Install
gem install bundler-audit
# Update database
bundle-audit update
# Run audit
bundle-audit check
# Output format
bundle-audit check --format json
SBOM Generation
CycloneDX
# Node.js
npx @cyclonedx/cyclonedx-npm@6.0.1 --output-file sbom.json
# Python
pip install cyclonedx-bom
cyclonedx-py environment -o sbom.json # or: requirements / poetry / pipenv subcommands (cyclonedx-bom 4+)
# Go
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.12.0
cyclonedx-gomod mod -json > sbom.json
Syft
# Install via a package manager
brew install syft
# Or download a pinned release binary and verify it against the release checksums file:
# https://github.com/anchore/syft/releases (vX.Y.Z, syft_X.Y.Z_checksums.txt)
# Generate SBOM
syft dir:/path/to/project -o cyclonedx-json > sbom.json
syft dir:/path/to/project -o spdx-json > sbom-spdx.json
# From container
syft myimage:latest -o cyclonedx-json > sbom.json
CI/CD Pipeline
# Comprehensive dependency scanning
name: Dependency Security
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 8 * * *'
jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: npm audit
run: npm audit --audit-level=high
- name: Snyk scan
uses: snyk/actions/node@<pinned-sha> # vX.Y.Z - never a branch ref
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_DISABLE_ANALYTICS: "1"
with:
args: --severity-threshold=high
- name: Generate SBOM
run: npx @cyclonedx/cyclonedx-npm@6.0.1 --output-file sbom.json
- name: Upload SBOM
uses: actions/upload-artifact@v4
with:
name: sbom
path: sbom.json
Common Issues
Issue: Too Many Alerts
Problem: Too many vulnerabilities to triage Solution: Prioritize by exploitability, filter by severity
Issue: No Fix Available
Problem: Vulnerable dependency has no patch Solution: Evaluate alternatives, add compensating controls
Issue: Breaking Updates
Problem: Security fix breaks functionality Solution: Review changelogs, test thoroughly, use lockfiles
Related Skills
code-audit- SAST review of first-party codedockerfile-optimise- image scanning (rulesec-scan-images)github-actions-advanced- wiring scanners into hardened workflowsdependency-upgrade- major upgrades that scans call forsecurity-and-hardening- install-script policy, new-dependency review
Done when
- Scanner runs on every pull request and on schedule against default branch, using committed lockfile.
- Build fails on new reachable critical/high findings. Accepted findings live in tool's ignore file with reason and expiry.
- SBOM generated for each release artifact. Dependabot or Renovate opens update PRs.
Adapted from BagelHole/DevOps-Security-Agent-Skills (MIT).
04 同仓库更多 Skills
wiki-builder
Create and maintain a local Markdown research wiki (sources with provenance, compiled concept/source pages, index, maintenance log) driven by a per-wiki config. Use when the user wants to start a wiki or knowledge base, ingest sources into one, or query and update it; use wiki-page-writer for a single code deep-dive page.
refactoring-guru
Diagnose a named code smell and apply the smallest behavior-preserving refactoring, with verification before and after and an explicit stop condition. Use for structural refactors (extract, move, consolidate, change ownership), not for feature or bug work; for readability cleanup of recent changes use code-simplification.
legacy-seams
When changing untested legacy code, pin the observed results with characterization tests and open the smallest seam that substitutes only the blocking dependency, separate from any later logic change. Use when a clock, random source, I/O, global, or hidden constructor blocks a test or a safe edit. Use test-driven-development for a new behavior or a bug, refactoring-guru for one named structural refactor after the seam exists, and code-refactoring-tech-debt to choose which legacy to replace.
idea-refine
Refine a raw idea into a one-page brief (problem statement, recommended direction, assumptions to validate, MVP scope, not-doing list) through divergent then convergent thinking. Use when an idea is still vague or you want options and a stress test before committing; use interview-me when the goal itself is unclear and spec-driven-development once the direction is chosen.
code-review-and-quality
Review rubric and approval standard for any change before merge, including code written by you, another agent, or a human: five axes (correctness, readability, architecture, security, performance), change sizing, structural remedies, severity labels, and feedback technique. Use to judge whether a change is fit to merge; use code-review to run a PR or diff review end to end.
code-perfection
Smell and style gate for code you write or change. Bans known code smells (long method, large class, primitive obsession, long parameter list, data clumps, duplicate code, dead code, feature envy, shotgun surgery, flag arguments, message chains) and enforces behavior-preserving structure. On Scala files, enforces worxbend style. Use while implementing, reviewing a diff for smells, or when a smell or style violation is suspected. Routine construction stays with code-complete. SOLID and DRY stay with clean-code-guard. One named structural refactor stays with refactoring-guru.