dependency-auditor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dependency Auditor

依赖项审计工具

Skill Type: POWERFUL
Category: Engineering
Domain: Dependency Management & Security
技能类型: POWERFUL
分类: 工程类
领域: 依赖管理与安全

Overview

概述

The Dependency Auditor is a comprehensive toolkit for analyzing, auditing, and managing dependencies across multi-language software projects. This skill provides deep visibility into your project's dependency ecosystem, enabling teams to identify vulnerabilities, ensure license compliance, optimize dependency trees, and plan safe upgrades.
In modern software development, dependencies form complex webs that can introduce significant security, legal, and maintenance risks. A single project might have hundreds of direct and transitive dependencies, each potentially introducing vulnerabilities, license conflicts, or maintenance burden. This skill addresses these challenges through automated analysis and actionable recommendations.
依赖项审计工具是一款用于分析、审计和管理多语言软件项目依赖项的综合性工具包。该工具可让团队深入了解项目的依赖生态系统,识别漏洞、确保许可证合规、优化依赖树并规划安全的升级方案。
在现代软件开发中,依赖项构成了复杂的网络,可能带来严重的安全、法律和维护风险。单个项目可能包含数百个直接和间接依赖项,每个都可能引入漏洞、许可证冲突或维护负担。该工具通过自动化分析和可执行建议解决这些挑战。

Core Capabilities

核心能力

1. Vulnerability Scanning & CVE Matching

1. 漏洞扫描与CVE匹配

Comprehensive Security Analysis
  • Scans dependencies against built-in vulnerability databases
  • Matches Common Vulnerabilities and Exposures (CVE) patterns
  • Identifies known security issues across multiple ecosystems
  • Analyzes transitive dependency vulnerabilities
  • Provides CVSS scores and exploit assessments
  • Tracks vulnerability disclosure timelines
  • Maps vulnerabilities to dependency paths
Multi-Language Support
  • JavaScript/Node.js: package.json, package-lock.json, yarn.lock
  • Python: requirements.txt, pyproject.toml, Pipfile.lock, poetry.lock
  • Go: go.mod, go.sum
  • Rust: Cargo.toml, Cargo.lock
  • Ruby: Gemfile, Gemfile.lock
  • Java/Maven: pom.xml, gradle.lockfile
  • PHP: composer.json, composer.lock
  • C#/.NET: packages.config, project.assets.json
全面安全分析
  • 针对内置漏洞数据库扫描依赖项
  • 匹配常见漏洞与暴露(CVE)模式
  • 识别多生态系统中的已知安全问题
  • 分析间接依赖项的漏洞
  • 提供CVSS评分和利用风险评估
  • 跟踪漏洞披露时间线
  • 映射漏洞到依赖路径
多语言支持
  • JavaScript/Node.js: package.json, package-lock.json, yarn.lock
  • Python: requirements.txt, pyproject.toml, Pipfile.lock, poetry.lock
  • Go: go.mod, go.sum
  • Rust: Cargo.toml, Cargo.lock
  • Ruby: Gemfile, Gemfile.lock
  • Java/Maven: pom.xml, gradle.lockfile
  • PHP: composer.json, composer.lock
  • C#/.NET: packages.config, project.assets.json

2. License Compliance & Legal Risk Assessment

2. 许可证合规与法律风险评估

License Classification System
  • Permissive Licenses: MIT, Apache 2.0, BSD (2-clause, 3-clause), ISC
  • Copyleft (Strong): GPL (v2, v3), AGPL (v3)
  • Copyleft (Weak): LGPL (v2.1, v3), MPL (v2.0)
  • Proprietary: Commercial, custom, or restrictive licenses
  • Dual Licensed: Multi-license scenarios and compatibility
  • Unknown/Ambiguous: Missing or unclear licensing
Conflict Detection
  • Identifies incompatible license combinations
  • Warns about GPL contamination in permissive projects
  • Analyzes license inheritance through dependency chains
  • Provides compliance recommendations for distribution
  • Generates legal risk matrices for decision-making
许可证分类系统
  • 宽松许可证: MIT, Apache 2.0, BSD(2条款、3条款), ISC
  • 强Copyleft许可证: GPL(v2, v3), AGPL(v3)
  • 弱Copyleft许可证: LGPL(v2.1, v3), MPL(v2.0)
  • 专有许可证: 商业、自定义或限制性许可证
  • 双重许可证: 多许可证场景及兼容性
  • 未知/模糊许可证: 缺失或不明确的许可信息
冲突检测
  • 识别不兼容的许可证组合
  • 警告宽松许可项目中的GPL污染问题
  • 分析依赖链中的许可证继承关系
  • 提供分发合规建议
  • 生成用于决策的法律风险矩阵

3. Outdated Dependency Detection

3. 过时依赖项检测

Version Analysis
  • Identifies dependencies with available updates
  • Categorizes updates by severity (patch, minor, major)
  • Detects pinned versions that may be outdated
  • Analyzes semantic versioning patterns
  • Identifies floating version specifiers
  • Tracks release frequencies and maintenance status
Maintenance Status Assessment
  • Identifies abandoned or unmaintained packages
  • Analyzes commit frequency and contributor activity
  • Tracks last release dates and security patch availability
  • Identifies packages with known end-of-life dates
  • Assesses upstream maintenance quality
版本分析
  • 识别有可用更新的依赖项
  • 按严重程度(补丁、次要、主要)分类更新
  • 检测可能过时的固定版本
  • 分析语义化版本(semver)模式
  • 识别浮动版本指定符
  • 跟踪发布频率和维护状态
维护状态评估
  • 识别已废弃或无人维护的包
  • 分析提交频率和贡献者活跃度
  • 跟踪最后发布日期和安全补丁可用性
  • 识别已知终止支持(EOL)日期的包
  • 评估上游维护质量

4. Dependency Bloat Analysis

4. 依赖项冗余分析

Unused Dependency Detection
  • Identifies dependencies that aren't actually imported/used
  • Analyzes import statements and usage patterns
  • Detects redundant dependencies with overlapping functionality
  • Identifies oversized packages for simple use cases
  • Maps actual vs. declared dependency usage
Redundancy Analysis
  • Identifies multiple packages providing similar functionality
  • Detects version conflicts in transitive dependencies
  • Analyzes bundle size impact of dependencies
  • Identifies opportunities for dependency consolidation
  • Maps dependency overlap and duplication
未使用依赖项检测
  • 识别未实际导入/使用的依赖项
  • 分析导入语句和使用模式
  • 检测功能重叠的冗余依赖项
  • 识别针对简单场景的过大包
  • 映射实际使用与声明的依赖项差异
冗余分析
  • 识别提供相似功能的多个包
  • 检测间接依赖项中的版本冲突
  • 分析依赖项对包体积的影响
  • 识别依赖项合并的机会
  • 映射依赖项重叠与重复情况

5. Upgrade Path Planning & Breaking Change Risk

5. 升级路径规划与破坏性变更风险

Semantic Versioning Analysis
  • Analyzes semver patterns to predict breaking changes
  • Identifies safe upgrade paths (patch/minor versions)
  • Flags major version updates requiring attention
  • Tracks breaking changes across dependency updates
  • Provides rollback strategies for failed upgrades
Risk Assessment Matrix
  • Low Risk: Patch updates, security fixes
  • Medium Risk: Minor updates with new features
  • High Risk: Major version updates, API changes
  • Critical Risk: Dependencies with known breaking changes
Upgrade Prioritization
  • Security patches: Highest priority
  • Bug fixes: High priority
  • Feature updates: Medium priority
  • Major rewrites: Planned priority
  • Deprecated features: Immediate attention
语义化版本分析
  • 分析semver模式以预测破坏性变更
  • 识别安全升级路径(补丁/次要版本)
  • 标记需要重点关注的主要版本更新
  • 跟踪依赖项更新中的破坏性变更
  • 提供升级失败后的回滚策略
风险评估矩阵
  • 低风险:补丁更新、安全修复
  • 中风险:含新功能的次要更新
  • 高风险:主要版本更新、API变更
  • 关键风险:存在已知破坏性变更的依赖项
升级优先级
  • 安全补丁:最高优先级
  • Bug修复:高优先级
  • 功能更新:中优先级
  • 重大重构:规划优先级
  • 废弃功能:立即关注

6. Supply Chain Security

6. 供应链安全

Dependency Provenance
  • Verifies package signatures and checksums
  • Analyzes package download sources and mirrors
  • Identifies suspicious or compromised packages
  • Tracks package ownership changes and maintainer shifts
  • Detects typosquatting and malicious packages
Transitive Risk Analysis
  • Maps complete dependency trees
  • Identifies high-risk transitive dependencies
  • Analyzes dependency depth and complexity
  • Tracks influence of indirect dependencies
  • Provides supply chain risk scoring
依赖项来源验证
  • 验证包签名和校验和
  • 分析包下载源和镜像
  • 识别可疑或被篡改的包
  • 跟踪包所有权变更和维护者变动
  • 检测仿冒包(typosquatting)和恶意包
间接风险分析
  • 映射完整依赖树
  • 识别高风险间接依赖项
  • 分析依赖深度和复杂度
  • 跟踪间接依赖项的影响
  • 提供供应链风险评分

7. Lockfile Analysis & Deterministic Builds

7. 锁定文件分析与确定性构建

Lockfile Validation
  • Ensures lockfiles are up-to-date with manifests
  • Validates integrity hashes and version consistency
  • Identifies drift between environments
  • Analyzes lockfile conflicts and resolution strategies
  • Ensures deterministic, reproducible builds
Environment Consistency
  • Compares dependencies across environments (dev/staging/prod)
  • Identifies version mismatches between team members
  • Validates CI/CD environment consistency
  • Tracks dependency resolution differences
锁定文件验证
  • 确保锁定文件与清单保持同步
  • 验证完整性哈希和版本一致性
  • 识别环境间的版本漂移
  • 分析锁定文件冲突及解决策略
  • 确保确定性、可重现的构建
环境一致性
  • 比较不同环境(开发/预发布/生产)的依赖项
  • 识别团队成员间的版本不匹配
  • 验证CI/CD环境一致性
  • 跟踪依赖项解析差异

Technical Architecture

技术架构

Scanner Engine (
dep_scanner.py
)

扫描引擎(
dep_scanner.py

  • Multi-format parser supporting 8+ package ecosystems
  • Built-in vulnerability database with 500+ CVE patterns
  • Transitive dependency resolution from lockfiles
  • JSON and human-readable output formats
  • Configurable scanning depth and exclusion patterns
  • 支持8+包生态系统的多格式解析器
  • 内置含500+CVE模式的漏洞数据库
  • 从锁定文件解析间接依赖项
  • JSON和人类可读的输出格式
  • 可配置的扫描深度和排除规则

License Analyzer (
license_checker.py
)

许可证分析器(
license_checker.py

  • License detection from package metadata and files
  • Compatibility matrix with 20+ license types
  • Conflict detection engine with remediation suggestions
  • Risk scoring based on distribution and usage context
  • Export capabilities for legal review
  • 从包元数据和文件中检测许可证
  • 含20+许可证类型的兼容性矩阵
  • 带修复建议的冲突检测引擎
  • 基于分发和使用场景的风险评分
  • 供法律审查的导出功能

Upgrade Planner (
upgrade_planner.py
)

升级规划器(
upgrade_planner.py

  • Semantic version analysis with breaking change prediction
  • Dependency ordering based on risk and interdependence
  • Migration checklists with testing recommendations
  • Rollback procedures for failed upgrades
  • Timeline estimation for upgrade cycles
  • 含破坏性变更预测的语义化版本分析
  • 基于风险和依赖关系的依赖项排序
  • 含测试建议的迁移清单
  • 升级失败后的回滚流程
  • 升级周期的时间预估

Use Cases & Applications

使用场景与应用

Security Teams

安全团队

  • Vulnerability Management: Continuous scanning for security issues
  • Incident Response: Rapid assessment of vulnerable dependencies
  • Supply Chain Monitoring: Tracking third-party security posture
  • Compliance Reporting: Automated security compliance documentation
  • 漏洞管理: 持续扫描安全问题
  • 事件响应: 快速评估受漏洞影响的依赖项
  • 供应链监控: 跟踪第三方安全状况
  • 合规报告: 自动化安全合规文档

Legal & Compliance Teams

法律与合规团队

  • License Auditing: Comprehensive license compliance verification
  • Risk Assessment: Legal risk analysis for software distribution
  • Due Diligence: Dependency licensing for M&A activities
  • Policy Enforcement: Automated license policy compliance
  • 许可证审计: 全面的许可证合规验证
  • 风险评估: 软件分发的法律风险分析
  • 尽职调查: 并购活动中的依赖项许可证审查
  • 政策执行: 自动化许可证政策合规

Development Teams

开发团队

  • Dependency Hygiene: Regular cleanup of unused dependencies
  • Upgrade Planning: Strategic dependency update scheduling
  • Performance Optimization: Bundle size optimization through dep analysis
  • Technical Debt: Identifying and prioritizing dependency technical debt
  • 依赖项卫生: 定期清理未使用的依赖项
  • 升级规划: 战略性依赖项更新调度
  • 性能优化: 通过依赖分析优化包体积
  • 技术债务: 识别并优先处理依赖项相关技术债务

DevOps & Platform Teams

DevOps与平台团队

  • Build Optimization: Faster builds through dependency optimization
  • Security Automation: Automated vulnerability scanning in CI/CD
  • Environment Consistency: Ensuring consistent dependencies across environments
  • Release Management: Dependency-aware release planning
  • 构建优化: 通过依赖优化加快构建速度
  • 安全自动化: 在CI/CD中自动化漏洞扫描
  • 环境一致性: 确保跨环境依赖项一致
  • 发布管理: 感知依赖项的发布规划

Integration Patterns

集成模式

CI/CD Pipeline Integration

CI/CD流水线集成

bash
undefined
bash
undefined

Security gate in CI

CI中的安全网关

python dep_scanner.py /project --format json --fail-on-high python license_checker.py /project --policy strict --format json
undefined
python dep_scanner.py /project --format json --fail-on-high python license_checker.py /project --policy strict --format json
undefined

Scheduled Audits

定期审计

bash
undefined
bash
undefined

Weekly dependency audit

每周依赖项审计

./audit_dependencies.sh > weekly_report.html python upgrade_planner.py deps.json --timeline 30days
undefined
./audit_dependencies.sh > weekly_report.html python upgrade_planner.py deps.json --timeline 30days
undefined

Development Workflow

开发工作流

bash
undefined
bash
undefined

Pre-commit dependency check

提交前依赖项检查

python dep_scanner.py . --quick-scan python license_checker.py . --warn-conflicts
undefined
python dep_scanner.py . --quick-scan python license_checker.py . --warn-conflicts
undefined

Advanced Features

高级功能

Custom Vulnerability Databases

自定义漏洞数据库

  • Support for internal/proprietary vulnerability feeds
  • Custom CVE pattern definitions
  • Organization-specific risk scoring
  • Integration with enterprise security tools
  • 支持内部/专有漏洞源
  • 自定义CVE模式定义
  • 组织特定的风险评分
  • 与企业安全工具集成

Policy-Based Scanning

基于策略的扫描

  • Configurable license policies by project type
  • Custom risk thresholds and escalation rules
  • Automated policy enforcement and notifications
  • Exception management for approved violations
  • 按项目类型配置许可证政策
  • 自定义风险阈值和升级规则
  • 自动化政策执行和通知
  • 已批准违规的例外管理

Reporting & Dashboards

报告与仪表盘

  • Executive summaries for management
  • Technical reports for development teams
  • Trend analysis and dependency health metrics
  • Integration with project management tools
  • 面向管理层的执行摘要
  • 面向开发团队的技术报告
  • 趋势分析和依赖项健康指标
  • 与项目管理工具集成

Multi-Project Analysis

多项目分析

  • Portfolio-level dependency analysis
  • Shared dependency impact analysis
  • Organization-wide license compliance
  • Cross-project vulnerability propagation
  • 组合级依赖项分析
  • 共享依赖项影响分析
  • 组织级许可证合规
  • 跨项目漏洞传播分析

Best Practices

最佳实践

Scanning Frequency

扫描频率

  • Security Scans: Daily or on every commit
  • License Audits: Weekly or monthly
  • Upgrade Planning: Monthly or quarterly
  • Full Dependency Audit: Quarterly
  • 安全扫描: 每日或每次提交时
  • 许可证审计: 每周或每月
  • 升级规划: 每月或每季度
  • 完整依赖项审计: 每季度

Risk Management

风险管理

  1. Prioritize Security: Address high/critical CVEs immediately
  2. License First: Ensure compliance before functionality
  3. Gradual Updates: Incremental dependency updates
  4. Test Thoroughly: Comprehensive testing after updates
  5. Monitor Continuously: Automated monitoring and alerting
  1. 安全优先: 立即处理高/关键级CVE
  2. 许可证先行: 在考虑功能前确保合规
  3. 逐步更新: 增量式依赖项更新
  4. 全面测试: 更新后进行全面测试
  5. 持续监控: 自动化监控和告警

Team Workflows

团队工作流

  1. Security Champions: Designate dependency security owners
  2. Review Process: Mandatory review for new dependencies
  3. Update Cycles: Regular, scheduled dependency updates
  4. Documentation: Maintain dependency rationale and decisions
  5. Training: Regular team education on dependency security
  1. 安全负责人: 指定依赖项安全所有者
  2. 审查流程: 新依赖项必须经过审查
  3. 更新周期: 定期、调度式的依赖项更新
  4. 文档记录: 保留依赖项选择理由和决策
  5. 培训: 定期开展团队依赖项安全培训

Metrics & KPIs

指标与KPI

Security Metrics

安全指标

  • Mean Time to Patch (MTTP) for vulnerabilities
  • Number of high/critical vulnerabilities
  • Percentage of dependencies with known vulnerabilities
  • Security debt accumulation rate
  • 漏洞平均修复时间(MTTP)
  • 高/关键级漏洞数量
  • 存在已知漏洞的依赖项占比
  • 安全债务累积率

Compliance Metrics

合规指标

  • License compliance percentage
  • Number of license conflicts
  • Time to resolve compliance issues
  • Policy violation frequency
  • 许可证合规率
  • 许可证冲突数量
  • 合规问题解决时间
  • 政策违规频率

Maintenance Metrics

维护指标

  • Percentage of up-to-date dependencies
  • Average dependency age
  • Number of abandoned dependencies
  • Upgrade success rate
  • 已更新依赖项占比
  • 平均依赖项使用时长
  • 已废弃依赖项数量
  • 升级成功率

Efficiency Metrics

效率指标

  • Bundle size reduction percentage
  • Unused dependency elimination rate
  • Build time improvement
  • Developer productivity impact
  • 包体积减少百分比
  • 未使用依赖项清除率
  • 构建时间提升幅度
  • 对开发者生产力的影响

Troubleshooting Guide

故障排除指南

Common Issues

常见问题

  1. False Positives: Tuning vulnerability detection sensitivity
  2. License Ambiguity: Resolving unclear or multiple licenses
  3. Breaking Changes: Managing major version upgrades
  4. Performance Impact: Optimizing scanning for large codebases
  1. 误报: 调整漏洞检测敏感度
  2. 许可证模糊: 解决不明确或多许可证问题
  3. 破坏性变更: 管理主要版本升级
  4. 性能影响: 针对大型代码库优化扫描

Resolution Strategies

解决策略

  • Whitelist false positives with documentation
  • Contact maintainers for license clarification
  • Implement feature flags for risky upgrades
  • Use incremental scanning for large projects
  • 对误报进行白名单并记录文档
  • 联系维护者澄清许可证信息
  • 为风险升级实现功能开关
  • 对大型项目使用增量扫描

Future Enhancements

未来增强

Planned Features

计划功能

  • Machine learning for vulnerability prediction
  • Automated dependency update pull requests
  • Integration with container image scanning
  • Real-time dependency monitoring dashboards
  • Natural language policy definition
  • 用于漏洞预测的机器学习
  • 自动化依赖项更新拉取请求
  • 与容器镜像扫描集成
  • 实时依赖项监控仪表盘
  • 自然语言政策定义

Ecosystem Expansion

生态系统扩展

  • Additional language support (Swift, Kotlin, Dart)
  • Container and infrastructure dependencies
  • Development tool and build system dependencies
  • Cloud service and SaaS dependency tracking

  • 新增语言支持(Swift、Kotlin、Dart)
  • 容器和基础设施依赖项
  • 开发工具和构建系统依赖项
  • 云服务和SaaS依赖项跟踪

Quick Start

快速开始

bash
undefined
bash
undefined

Scan project for vulnerabilities and licenses

扫描项目的漏洞和许可证

python scripts/dep_scanner.py /path/to/project
python scripts/dep_scanner.py /path/to/project

Check license compliance

检查许可证合规性

python scripts/license_checker.py /path/to/project --policy strict
python scripts/license_checker.py /path/to/project --policy strict

Plan dependency upgrades

规划依赖项升级

python scripts/upgrade_planner.py deps.json --risk-threshold medium

For detailed usage instructions, see [README.md](README.md).

---

*This skill provides comprehensive dependency management capabilities essential for maintaining secure, compliant, and efficient software projects. Regular use helps teams stay ahead of security threats, maintain legal compliance, and optimize their dependency ecosystems.*
python scripts/upgrade_planner.py deps.json --risk-threshold medium

详细使用说明请查看[README.md](README.md)。

---

*该工具提供全面的依赖项管理能力,对于维护安全、合规且高效的软件项目至关重要。定期使用可帮助团队提前应对安全威胁、保持法律合规并优化依赖生态系统。*