SandikaGaming/dependency-hardlock-guard

GitHub: SandikaGaming/dependency-hardlock-guard

Dependency Vanguard 是一款 CI/CD 依赖变更门禁工具,通过强制人工审查与理由文件记录,阻断未经审查的依赖版本更新进入代码库。

Stars: 0 | Forks: 0

# Dependency Vanguard:面向现代 CI/CD 流水线的自动化版本完整性盾牌 ## 🧭 概述:依赖卫生的 Git 原生守护者 每个软件项目都是一座用借来的砖块建成的房子。随着时间的推移,随着添加新包和升级旧包,代码库的结构完整性可能会悄然受损。**Dependency Vanguard** 是一款 pre-commit 和 CI/CD 强制执行工具,它将每一次依赖变更——添加、移除或版本升级——都包裹在一个强制性的、经人工验证的代码审查检查点中。它迫使开发者在修改被允许进入提交历史之前,记录*为什么*要更改依赖,以及*哪个来源或参考*证明了该更改的合理性。 把它想象成一个**针对你的 `package.json`、`Cargo.toml`、`requirements.txt` 或 `*.csproj` 文件的保安**。它不会阻碍创新;它阻断的是那些困扰着现代软件交付的未经审查、低质量或无视安全的依赖变更。 ## 📊 工作原理:检查门 (Mermaid 图表) ``` flowchart TD A[Developer attempts to modify dependency file] --> B{Dependency Vanguard Pre-Hook} B -->|Change detected| C[Extract: What changed? Old version vs new version] C --> D{Is this a known, vetted change?} D -->|No| E[Block commit. Require dependency justification file] E --> F[Developer creates: .dependency-vault/YYYY-MM-DD--change-id.json] F --> G[Gate validates: file contains source URL, CVE links, or design rationale] G -->|Valid| H[Allow commit. Log change to permanent audit trail.] G -->|Invalid| I[Reject commit. Return error message with missing fields.] D -->|Yes| H ``` ## 🧩 示例 Profile 配置 Dependency Vanguard 使用存储在你的 repository 根目录或全局用户目录中的 YAML profile。此 profile 定义了要监控哪些生态系统、证明更改合理性需要哪些必填字段,以及哪些分支可以被豁免。 ``` # .dependency-vanguard.yaml version: "2.1" enabled: true ecosystems: - npm - pip - cargo - nuget - poetry strict_mode: true justification_fields: - reason: required - source_url: required - cve_identifier: optional - developer_signoff: required audit_log_path: .dependency-audit/ ignore_patterns: - "dev-dependencies" - "lockfile-only-changes" branch_exceptions: - name: "renovate/*" policy: "skip_justification" timezone: "UTC" ``` ## 🖥️ 示例控制台调用 Dependency Vanguard 既可作为 Git pre-commit hook 运行,也可作为用于 CI/CD 流水线的独立 CLI 工具运行。 ``` # 全局安装 pre-commit hook(需要一次性设置) dependency-vanguard install --global # 在不 commit 的情况下对特定文件运行扫描 dependency-vanguard inspect --file path/to/package.json --verbose # 强制 bypass 关键 hotfix(生成一个临时 audit token) dependency-vanguard bypass --reason "P0 security patch for log4shell" --token-expire 24h # 验证所有待处理的 dependency justification 文件 dependency-vanguard validate --audit-dir .dependency-audit/ # 生成所有未验证更改的易读报告 dependency-vanguard report --format table --output status.html ``` ## 💻 操作系统兼容性表 Dependency Vanguard 旨在 wherever your code lives 之处运行。下表显示了 2026 年已验证的平台支持情况。 | 操作系统 | CLI Binary | Pre-Commit Hook | CI/CD Runner | |---|---|---|---| | Windows 11 / Server 2025 | ✅ | ✅ | ✅ | | macOS Ventura / Sonoma | ✅ | ✅ | ✅ | | Ubuntu 24.04 LTS | ✅ | ✅ | ✅ | | Debian 12 | ✅ | ✅ | ✅ | | Red Hat Enterprise Linux 9 | ✅ | ✅ | ✅ | | Alpine Linux (Docker) | ✅ | ❌ | ✅ | | FreeBSD 14 | ❌ | ✅ | ❌ | ## ✨ 功能亮点:超越显而易见之处 ### 🧠 深度依赖图谱上下文感知 与简单的版本锁定工具不同,Dependency Vanguard 理解依赖*关系*。它可以检测到传递性依赖的升级何时引入了冲突的版本链,从而防止“抽线头”(pulling the thread)问题——即一次无害的升级级联导致五十个模块损坏。 ### 📝 多语言证明引擎 开发者使用不同的语言——无论是字面意义还是隐喻意义上。Vanguard 支持使用英语、简体中文、西班牙语 和德语 编写的证明文件。验证引擎会实时翻译必填字段。 ### 🔄 零停机策略切换 团队突然决定全面进入严格模式?Vanguard 允许通过基于分支的策略进行逐步推出。你可以在 `develop` 分支上测试严格强制执行两周,然后再在 `main` 分支上启用它。 ### 🛡️ OpenAI API 和 Claude API 集成以实现智能证明 当开发者无法立即写出证明时,Vanguard 可以选择调用 OpenAI API 或 Claude API,根据 changelog diff、发布说明和公开的漏洞数据库建议一个合理的解释。这完全是可选的,并受 token 门控。 ``` dependency-vanguard auto-justify --api openai --model gpt-5-turbo --dry-run ``` ### 📈 响应式 Web Dashboard 一个轻量级的配套 HTML dashboard(无需外部服务器)将你的依赖审计日志渲染为交互式、响应式的时间线。按生态系统、开发者或日期范围进行筛选。适用于移动浏览器,方便待命工程师使用。 ### 🗣️ 7x24 小时社区与企业支持 - **社区支持**:响应 webhook 事件和常见安装错误的 Discord bot。 - **企业支持**:直接升级至专属团队,针对生产事件保证 2 小时内响应。包括自定义策略模板。 ## 📜 许可证与法律避风港 本项目基于 **MIT License** 发布。只要保留原始版权声明,你就可以自由地在私人或商业 repository 中使用、修改和分发 Dependency Vanguard。 完整的许可证文本可在以下地址获取: [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) ## ⚠️ 免责声明 Dependency Vanguard 是一款旨在改善代码审查规范和依赖安全性的工具。它**不能替代**专业的安全审计、手动代码审查或正式的漏洞管理程序。作者不保证所有未经核实的依赖变更都会被阻断,也不保证被阻断的变更本身是不安全的。在生产环境中使用此工具需要进行适当的测试,并与你所在组织的风险承受能力进行配置对齐。OpenAI 和 Claude API 功能按“原样”提供,可能会生成不准确或具有误导性的证明。请务必核实 AI 生成的内容的正确性。 ### 🚀 SEO 关键词和搜索短语 本项目面向 2026 年的工程师和 DevSecOps 专业人士,针对以下搜索意图: - *Dependency management automation tool CI/CD* - *Pre-commit hook for package.json version control* - *Automated dependency justification workflow* - *Security gate for npm pip Cargo NuGet* - *Block unverified dependency updates* - *Git hook for dependency audit trail* - *Open source dependency vanguard alternative* - *Multi-language justification for code review* - *Claude API and OpenAI API integration for DevOps* **Dependency Vanguard:因为每一个依赖都值得再看一眼。**
标签:Petitpotam, 代码审查, 依赖管理, 后端开发, 多模态安全, 文档结构分析