aiexponenthq/license-compliance-checker
GitHub: aiexponenthq/license-compliance-checker
一款开源的多生态许可证与AI模型合规扫描工具,将传统依赖许可证检测、AI模型许可证分析和欧盟《AI法案》第53条合规证据收集融为一体。
Stars: 1 | Forks: 0
License Compliance Checker (LCC)
了解你交付了什么。了解你欠了什么。
唯一一款将依赖许可证检测、AI 模型许可证分析和欧盟《AI 法案》第 53 条合规性结合于一体的开源扫描工具。 由 [AI Exponent LLC](https://aiexponent.com) 构建。Apache 2.0 许可证。FOSSA ($50K+/yr) 和 Black Duck ($30K+/yr) 的免费替代方案。 ## 快速开始 ``` pip install license-compliance-checker # 扫描项目 lcc scan . # 使用 EU AI Act 合规策略进行扫描 lcc scan . --policy eu-ai-act-compliance --format json # 生成 CycloneDX SBOM lcc sbom generate --input scan-report.json --format cyclonedx --output sbom.json # 在 SaaS 环境中检查 GPL contamination lcc scan . --project-license Apache-2.0 --context saas ``` ## 为什么选择 LCC | | LCC | FOSSA | Black Duck | |---|---|---|---| | AI 模型许可证检测 | ✅ | ❌ | ❌ | | 欧盟《AI 法案》第 53 条输出 | ✅ | ❌ | ❌ | | HuggingFace Hub API 解析器 | ✅ | ❌ | ❌ | | GGUF / ONNX 模型扫描 | ✅ | ❌ | ❌ | | 训练数据风险登记表 | ✅ | ❌ | ❌ | | SBOM (CycloneDX + SPDX) | ✅ | ✅ | ✅ | | 策略即代码 (OPA / YAML) | ✅ | ✅ | ✅ | | 价格 | **免费** | $50K+/yr | $30K+/yr | ## 架构 ``` graph TD CLI["CLI · FastAPI Server · GitHub Action · VS Code Extension"] DET["Detectors\nPython · Node.js · Go · Rust · Ruby\nJava · .NET · HuggingFace · GGUF/ONNX"] RES["Resolvers\nPyPI · npm · Crates.io · Maven\nGitHub API · ClearlyDefined · HF Hub API"] POL["Policy Engine\nOPA Rego · YAML policies\nPermissive · Strict · EU AI Act"] REG["Regulatory Assessor\nEU AI Act Article 53\nNIST AI RMF · ISO 42001"] OUT["Outputs\nJSON · HTML · Markdown · CSV\nCycloneDX SBOM · SPDX SBOM\nArticle 53 compliance pack"] CLI --> DET DET -->|"detected components"| RES RES -->|"resolved licenses"| POL POL -->|"violations + warnings"| REG REG --> OUT style CLI fill:#1e3a5f,color:#fff style DET fill:#1e3a5f,color:#fff style RES fill:#1e3a5f,color:#fff style POL fill:#c9a84c,color:#000 style REG fill:#c9a84c,color:#000 style OUT fill:#2d5a2d,color:#fff ``` ## 生态系统覆盖 ``` graph LR LCC["LCC\nScanner"] PY["Python\npip · Poetry · Conda"] JS["JavaScript\nnpm · Yarn · pnpm"] GO["Go\ngo.mod"] RS["Rust\nCargo.toml"] JV["Java\nMaven · Gradle"] RB["Ruby\nBundler"] DN[".NET\nNuGet"] HF["HuggingFace\nHub API · Model cards\nGGUF · ONNX"] LCC --> PY LCC --> JS LCC --> GO LCC --> RS LCC --> JV LCC --> RB LCC --> DN LCC --> HF style LCC fill:#1e3a5f,color:#fff style HF fill:#c9a84c,color:#000 ``` ## 欧盟《AI 法案》第 53 条覆盖范围 2025 年 8 月 — GPAI 义务**已强制执行**。通用 AI 模型的提供商必须发布技术文档。LCC 自动收集每个子义务的证据: ``` graph TD A53["Article 53\nObligations"] A["53(1)(a)\nTechnical documentation\n→ SBOM with model type,\nversion, license metadata"] B["53(1)(b)\nDownstream provider info\n→ Model card capabilities\nand limitations extracted"] C["53(1)(c)\nCopyright policy\n→ Training data licenses\nand copyright flags"] D["53(1)(d)\nTraining data summary\n→ Dataset descriptions\nfrom model cards"] E["53(2)\nSystemic risk\n→ 65B+ parameter\nmodel detection"] A53 --> A A53 --> B A53 --> C A53 --> D A53 --> E style A53 fill:#1e3a5f,color:#fff style A fill:#1e3a5f,color:#fff style B fill:#1e3a5f,color:#fff style C fill:#1e3a5f,color:#fff style D fill:#1e3a5f,color:#fff style E fill:#c9a84c,color:#000 ``` ## AI 模型检测 LCC 扫描你的代码库以查找 AI 模型引用,而无需在本地下载: ``` # 检测 Python / YAML / JSON 中的 from_pretrained("org/model") 引用 lcc scan . # 检测 GGUF 和 ONNX 模型文件 (Ollama / llama.cpp) lcc scan /path/to/models # 使用 lock file 进行完整 transitive 扫描 lcc scan . --include-transitive --policy permissive ``` **支持的 AI 许可证格式:** RAIL、OpenRAIL、Llama 2/3/3.1、Gemma、Mistral、Mixtral、BigScience、Falcon、Grok、DeepSeek 等 20 多种。 **训练数据风险登记表:** 标记具有商业使用风险的数据集 —— OpenAI API 输出、ShareGPT、Books3、The Pile 被归类为高/严重风险。 ## 策略执行 ``` # 内置 policies lcc scan . --policy permissive # Allow MIT, Apache-2.0, BSD only lcc scan . --policy strict # Block all copyleft lcc scan . --policy eu-ai-act-compliance # Article 53 GPAI obligations # 自定义 policy (YAML) cat > my-policy.yaml << EOF name: my-saas-policy rules: - license: GPL-3.0 action: block reason: "GPL-3.0 requires SaaS source disclosure" - license: AGPL-3.0 action: block - license: RAIL action: warn reason: "Review RAIL restrictions before deploying" EOF lcc scan . --policy my-policy.yaml ``` ## CI/CD 集成 ``` # .github/workflows/license-check.yml - name: License compliance scan uses: aiexponenthq/license-compliance-checker/.github/actions/license-compliance@v1 with: path: . policy: eu-ai-act-compliance fail-on: violations format: sarif output: license-scan.sarif ``` ## SBOM 生成 ``` # 带有 EU AI Act 监管扩展的 CycloneDX 1.4 lcc sbom generate --input scan-report.json --format cyclonedx --output sbom.cdx.json # SPDX 2.3 lcc sbom generate --input scan-report.json --format spdx --output sbom.spdx.json # 使用 GPG 签名以提供 tamper-evidence lcc sbom sign --input sbom.cdx.json --key ~/.gnupg/key.gpg ``` ## AiExponent 工具链 ``` graph LR TF["TraceForge\n(Art. 10 data governance)"] LCC["LCC\n(Art. 53 license compliance)"] RAG["rag-benchmarking\n(Art. 15 accuracy)"] RF["RiskForge\n(Art. 9 risk management)"] TD["TransparencyDeck\n(Art. 13 documentation)"] TF -->|"data provenance"| LCC LCC -->|"license evidence"| RF RAG -->|"accuracy evidence"| RF RF -->|"rmf.json"| TD style LCC fill:#c9a84c,color:#000 style RF fill:#1e3a5f,color:#fff style TF fill:#1e3a5f,color:#fff style RAG fill:#1e3a5f,color:#fff style TD fill:#1e3a5f,color:#fff ``` ## 已知限制 - HuggingFace Hub API 扫描需要引用的模型 ID(而不仅是本地下载)。 - SPDX `AND`/`OR` 复合表达式会被标记为供人工审查,而不会自动解决。 - 传递依赖解析需要 lock 文件(如 `poetry.lock`、`package-lock.json`)。 - 第 53 条评估仅涵盖文档完整性 —— 并非法律合规性判定。 - 训练数据风险登记表涵盖前 50 个已知数据集;未知数据集会被标记以待审查。 ## 贡献 参见 [CONTRIBUTING.md](CONTRIBUTING.md)。欢迎提交 Issues 和 PR。 ``` git clone https://github.com/aiexponenthq/license-compliance-checker cd license-compliance-checker pip install -e ".[dev]" pytest ``` ## 许可证 [Apache 2.0](LICENSE) — 可免费使用、修改和分发。 由 [AI Exponent LLC](https://aiexponent.com) 构建 — `hello@aiexponent.com` *AiExponent 开源 AI 治理工具链的一部分: **license-compliance-checker** · [rag-benchmarking](https://github.com/aiexponenthq/rag-benchmarking) · [RiskForge](https://github.com/aiexponenthq/riskforge)*标签:AI安全, AI模型扫描, Apache 2.0, Article 53, Chat Copilot, CI-CD集成, CycloneDX, DevSecOps, EU AI Act, GPAI, GPL传染性检测, Python开发, SaaS合规, SARIF, SBOM, WebSocket, 上游代理, 依赖分析, 多生态系统, 开源许可证合规, 开源软件审计, 替代Black Duck, 替代FOSSA, 欧盟人工智能法案, 硬件无关, 网络安全, 训练数据风险分析, 许可证冲突检测, 跌倒检测, 软件物料清单, 逆向工具, 通用人工智能模型, 隐私保护, 静态分析结果交换格式, 风险检测
