cbomly 0.3.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cbomly-0.3.0/src/cbomly.egg-info → cbomly-0.4.0}/PKG-INFO +23 -21
- {cbomly-0.3.0 → cbomly-0.4.0}/README.md +22 -20
- {cbomly-0.3.0 → cbomly-0.4.0}/pyproject.toml +1 -1
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/__init__.py +1 -1
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/cbom.py +69 -1
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/cli.py +17 -8
- cbomly-0.4.0/src/cbomly/detect/ai.py +298 -0
- cbomly-0.4.0/src/cbomly/detect/manifest.py +97 -0
- cbomly-0.4.0/src/cbomly/detect/vendors.py +313 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/report.py +85 -4
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/sbom.py +19 -4
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/scanner.py +27 -3
- cbomly-0.4.0/src/cbomly/syft_fetch.py +119 -0
- {cbomly-0.3.0 → cbomly-0.4.0/src/cbomly.egg-info}/PKG-INFO +23 -21
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly.egg-info/SOURCES.txt +4 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/tests/test_cli.py +23 -3
- {cbomly-0.3.0 → cbomly-0.4.0}/LICENSE +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/NOTICE +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/setup.cfg +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/__main__.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/algorithms.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/cbom_names.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/detect/__init__.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/detect/deps.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/detect/keys.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/detect/services.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/detect/source.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/findings.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/importer.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/inventory.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/au.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/baseline.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/ca.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/eu.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/india.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/jp.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/pci-dss.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/sg.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/uk.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/us-cnsa2.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/us-fda.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/packs/us.toml +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/rules.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly/upload.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly.egg-info/dependency_links.txt +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly.egg-info/entry_points.txt +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly.egg-info/requires.txt +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/src/cbomly.egg-info/top_level.txt +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/tests/test_keys.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/tests/test_rules.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/tests/test_source.py +0 -0
- {cbomly-0.3.0 → cbomly-0.4.0}/tests/test_upload.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cbomly
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Find the cryptography in your software, write a CycloneDX CBOM, and check it is quantum-safe.
|
|
5
5
|
Author-email: Cbomly <team@cbomly.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -30,8 +30,8 @@ Dynamic: license-file
|
|
|
30
30
|
|
|
31
31
|
Cbomly scans a codebase and writes a **CBOM** (cryptographic bill of materials): a list of every
|
|
32
32
|
algorithm, key and certificate your product uses, with the file and line where it was found. It also
|
|
33
|
-
writes the normal software list (**SBOM**)
|
|
34
|
-
computer would break, and what to replace it with.
|
|
33
|
+
writes the normal software list (**SBOM**), lists the **AI models** and **third-party services** the product
|
|
34
|
+
uses, and a plain-English report that says what a future quantum computer would break, and what to replace it with.
|
|
35
35
|
|
|
36
36
|
It runs locally on Linux, macOS and Windows. Nothing is uploaded unless you run `cbomly upload` to keep your
|
|
37
37
|
reports in a free dashboard at [app.cbomly.com](https://app.cbomly.com), and even then only findings are
|
|
@@ -77,25 +77,23 @@ CBOM and a migration plan:
|
|
|
77
77
|
|
|
78
78
|
## Install
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
One command installs the scanner and [Syft](https://github.com/anchore/syft) (which builds the software list).
|
|
81
|
+
It needs no admin rights and fetches its own Python if yours is older than 3.11:
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
# macOS
|
|
85
|
-
|
|
86
|
-
pipx install cbomly
|
|
84
|
+
# macOS and Linux
|
|
85
|
+
curl -LsSf https://cbomly.com/install.sh | sh
|
|
87
86
|
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b ~/.local/bin
|
|
87
|
+
# Windows (PowerShell or Command Prompt)
|
|
88
|
+
powershell -ExecutionPolicy ByPass -c "irm https://cbomly.com/install.ps1 | iex"
|
|
89
|
+
```
|
|
92
90
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
winget install Anchore.syft # or: scoop install main/syft; then open a new terminal
|
|
91
|
+
Already have Python 3.11 or newer? `pipx install cbomly` works too. If Syft isn't installed, the first
|
|
92
|
+
`cbomly scan` downloads Anchore's official Syft release for your system, checks its SHA-256 against the
|
|
93
|
+
release's checksums, and keeps it in your user data folder (`~/.local/share/cbomly/bin` on Linux).
|
|
94
|
+
Set `CBOMLY_NO_SYFT=1` to never download it, or point `CBOMLY_SYFT` at your own copy.
|
|
98
95
|
|
|
96
|
+
```bash
|
|
99
97
|
cbomly doctor # checks everything is in place
|
|
100
98
|
```
|
|
101
99
|
|
|
@@ -121,9 +119,9 @@ Output goes to `./cbomly-out/`:
|
|
|
121
119
|
|
|
122
120
|
| File | What it is |
|
|
123
121
|
|---|---|
|
|
124
|
-
| `cbom.cdx.json` | CycloneDX 1.6 BOM: the software components from Syft, one `cryptographic-asset` per algorithm, key, certificate and protocol (each with file and line evidence and a `cbomly:status`), and crypto services
|
|
125
|
-
| `summary.md` | The readable report: what is quantum-vulnerable, where, what to do, the full crypto inventory, and
|
|
126
|
-
| `findings.json` | Findings, rule results, inventory and
|
|
122
|
+
| `cbom.cdx.json` | CycloneDX 1.6 BOM: the software components from Syft, one `cryptographic-asset` per algorithm, key, certificate and protocol (each with file and line evidence and a `cbomly:status`), one `machine-learning-model` per AI model, and every third-party service (crypto services, AI providers, payments, email…) under `services` |
|
|
123
|
+
| `summary.md` | The readable report: what is quantum-vulnerable, where, what to do, the full crypto inventory, AI models and libraries, and the vendor inventory |
|
|
124
|
+
| `findings.json` | Findings, rule results, inventory, AI (`ai`) and vendor inventory (`third_party_services`), for scripts and `cbomly upload` |
|
|
127
125
|
|
|
128
126
|
## Dashboard and CI
|
|
129
127
|
|
|
@@ -157,12 +155,16 @@ the trend view, alerts for new RSA/ECC and the release gate.
|
|
|
157
155
|
| Dependencies (via Syft) | Crypto libraries such as OpenSSL, Bouncy Castle and Go's standard library, and whether the version supports post-quantum algorithms |
|
|
158
156
|
| Post-quantum use | ML-KEM, ML-DSA, SLH-DSA and hybrid X25519MLKEM768 are recognised and reported as good news |
|
|
159
157
|
| Third-party crypto services | AWS KMS, CloudHSM, Certificate Manager and Secrets Manager, Google Cloud KMS and Secret Manager, Azure Key Vault, HashiCorp Vault, Thales Luna, YubiHSM, Fortanix, PKCS#11 HSMs, Let's Encrypt and eMudhra, listed as vendors |
|
|
158
|
+
| AI models | Model files (Safetensors, GGUF, ONNX, PyTorch, TensorFlow, Keras, Core ML, TFLite and more, with SHA-256; Git LFS pointers count too), Hugging Face model ids in code, and hosted models named in code or config (GPT, Claude, Gemini, Llama, Mistral, DeepSeek and others). Pickle-based model files are flagged because they can run code when loaded |
|
|
159
|
+
| AI libraries | ML frameworks (PyTorch, TensorFlow, Transformers, scikit-learn…), model runtimes (ONNX Runtime, llama.cpp, Ollama, vLLM…), LLM and agent frameworks (LangChain, LlamaIndex, Vercel AI SDK…) and AI provider SDKs, from imports, manifests and the SBOM |
|
|
160
|
+
| Third-party services (vendor inventory) | About 90 services across AI providers, cloud (per service, e.g. Amazon S3), payments, email, SMS, identity, analytics, monitoring, hosted databases, search and more, found from SDK imports, API hostnames, API-key variable names, manifests (requirements.txt, package.json, go.mod, pom.xml, Gemfile, Cargo.toml, .csproj…) and the SBOM |
|
|
160
161
|
| Safe crypto | AES (with key size and mode), ChaCha20-Poly1305, SHA-2, SHA-3, BLAKE2, HMAC, key derivation (PBKDF2, HKDF, scrypt, Argon2, bcrypt) and secure random number generators. Listed in the CBOM and marked quantum-safe, so the inventory is complete. AES-128 is marked "weakened by quantum" |
|
|
161
162
|
|
|
162
163
|
Every algorithm, certificate, key and protocol gets one status: **broken**, **deprecated**,
|
|
163
164
|
**quantum-vulnerable**, **weakened** (by quantum attacks, e.g. AES-128) or **safe**. Certificates also
|
|
164
|
-
show issuer, public key, signature and expiry. Keys show size or curve. The **
|
|
165
|
+
show issuer, public key, signature and expiry. Keys show size or curve. The **Crypto vendors** section lists
|
|
165
166
|
who supplies or controls your crypto: library makers, certificate issuers, and key management services.
|
|
167
|
+
AI detection and the vendor inventory always run; they never send anything anywhere.
|
|
166
168
|
|
|
167
169
|
Detection is pattern-based, so it is fast and needs no build, but it can miss crypto hidden inside
|
|
168
170
|
compiled binaries or wrapper functions, and it can report false positives. Findings carry a
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Cbomly scans a codebase and writes a **CBOM** (cryptographic bill of materials): a list of every
|
|
6
6
|
algorithm, key and certificate your product uses, with the file and line where it was found. It also
|
|
7
|
-
writes the normal software list (**SBOM**)
|
|
8
|
-
computer would break, and what to replace it with.
|
|
7
|
+
writes the normal software list (**SBOM**), lists the **AI models** and **third-party services** the product
|
|
8
|
+
uses, and a plain-English report that says what a future quantum computer would break, and what to replace it with.
|
|
9
9
|
|
|
10
10
|
It runs locally on Linux, macOS and Windows. Nothing is uploaded unless you run `cbomly upload` to keep your
|
|
11
11
|
reports in a free dashboard at [app.cbomly.com](https://app.cbomly.com), and even then only findings are
|
|
@@ -51,25 +51,23 @@ CBOM and a migration plan:
|
|
|
51
51
|
|
|
52
52
|
## Install
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
One command installs the scanner and [Syft](https://github.com/anchore/syft) (which builds the software list).
|
|
55
|
+
It needs no admin rights and fetches its own Python if yours is older than 3.11:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
# macOS
|
|
59
|
-
|
|
60
|
-
pipx install cbomly
|
|
58
|
+
# macOS and Linux
|
|
59
|
+
curl -LsSf https://cbomly.com/install.sh | sh
|
|
61
60
|
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b ~/.local/bin
|
|
61
|
+
# Windows (PowerShell or Command Prompt)
|
|
62
|
+
powershell -ExecutionPolicy ByPass -c "irm https://cbomly.com/install.ps1 | iex"
|
|
63
|
+
```
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
winget install Anchore.syft # or: scoop install main/syft; then open a new terminal
|
|
65
|
+
Already have Python 3.11 or newer? `pipx install cbomly` works too. If Syft isn't installed, the first
|
|
66
|
+
`cbomly scan` downloads Anchore's official Syft release for your system, checks its SHA-256 against the
|
|
67
|
+
release's checksums, and keeps it in your user data folder (`~/.local/share/cbomly/bin` on Linux).
|
|
68
|
+
Set `CBOMLY_NO_SYFT=1` to never download it, or point `CBOMLY_SYFT` at your own copy.
|
|
72
69
|
|
|
70
|
+
```bash
|
|
73
71
|
cbomly doctor # checks everything is in place
|
|
74
72
|
```
|
|
75
73
|
|
|
@@ -95,9 +93,9 @@ Output goes to `./cbomly-out/`:
|
|
|
95
93
|
|
|
96
94
|
| File | What it is |
|
|
97
95
|
|---|---|
|
|
98
|
-
| `cbom.cdx.json` | CycloneDX 1.6 BOM: the software components from Syft, one `cryptographic-asset` per algorithm, key, certificate and protocol (each with file and line evidence and a `cbomly:status`), and crypto services
|
|
99
|
-
| `summary.md` | The readable report: what is quantum-vulnerable, where, what to do, the full crypto inventory, and
|
|
100
|
-
| `findings.json` | Findings, rule results, inventory and
|
|
96
|
+
| `cbom.cdx.json` | CycloneDX 1.6 BOM: the software components from Syft, one `cryptographic-asset` per algorithm, key, certificate and protocol (each with file and line evidence and a `cbomly:status`), one `machine-learning-model` per AI model, and every third-party service (crypto services, AI providers, payments, email…) under `services` |
|
|
97
|
+
| `summary.md` | The readable report: what is quantum-vulnerable, where, what to do, the full crypto inventory, AI models and libraries, and the vendor inventory |
|
|
98
|
+
| `findings.json` | Findings, rule results, inventory, AI (`ai`) and vendor inventory (`third_party_services`), for scripts and `cbomly upload` |
|
|
101
99
|
|
|
102
100
|
## Dashboard and CI
|
|
103
101
|
|
|
@@ -131,12 +129,16 @@ the trend view, alerts for new RSA/ECC and the release gate.
|
|
|
131
129
|
| Dependencies (via Syft) | Crypto libraries such as OpenSSL, Bouncy Castle and Go's standard library, and whether the version supports post-quantum algorithms |
|
|
132
130
|
| Post-quantum use | ML-KEM, ML-DSA, SLH-DSA and hybrid X25519MLKEM768 are recognised and reported as good news |
|
|
133
131
|
| Third-party crypto services | AWS KMS, CloudHSM, Certificate Manager and Secrets Manager, Google Cloud KMS and Secret Manager, Azure Key Vault, HashiCorp Vault, Thales Luna, YubiHSM, Fortanix, PKCS#11 HSMs, Let's Encrypt and eMudhra, listed as vendors |
|
|
132
|
+
| AI models | Model files (Safetensors, GGUF, ONNX, PyTorch, TensorFlow, Keras, Core ML, TFLite and more, with SHA-256; Git LFS pointers count too), Hugging Face model ids in code, and hosted models named in code or config (GPT, Claude, Gemini, Llama, Mistral, DeepSeek and others). Pickle-based model files are flagged because they can run code when loaded |
|
|
133
|
+
| AI libraries | ML frameworks (PyTorch, TensorFlow, Transformers, scikit-learn…), model runtimes (ONNX Runtime, llama.cpp, Ollama, vLLM…), LLM and agent frameworks (LangChain, LlamaIndex, Vercel AI SDK…) and AI provider SDKs, from imports, manifests and the SBOM |
|
|
134
|
+
| Third-party services (vendor inventory) | About 90 services across AI providers, cloud (per service, e.g. Amazon S3), payments, email, SMS, identity, analytics, monitoring, hosted databases, search and more, found from SDK imports, API hostnames, API-key variable names, manifests (requirements.txt, package.json, go.mod, pom.xml, Gemfile, Cargo.toml, .csproj…) and the SBOM |
|
|
134
135
|
| Safe crypto | AES (with key size and mode), ChaCha20-Poly1305, SHA-2, SHA-3, BLAKE2, HMAC, key derivation (PBKDF2, HKDF, scrypt, Argon2, bcrypt) and secure random number generators. Listed in the CBOM and marked quantum-safe, so the inventory is complete. AES-128 is marked "weakened by quantum" |
|
|
135
136
|
|
|
136
137
|
Every algorithm, certificate, key and protocol gets one status: **broken**, **deprecated**,
|
|
137
138
|
**quantum-vulnerable**, **weakened** (by quantum attacks, e.g. AES-128) or **safe**. Certificates also
|
|
138
|
-
show issuer, public key, signature and expiry. Keys show size or curve. The **
|
|
139
|
+
show issuer, public key, signature and expiry. Keys show size or curve. The **Crypto vendors** section lists
|
|
139
140
|
who supplies or controls your crypto: library makers, certificate issuers, and key management services.
|
|
141
|
+
AI detection and the vendor inventory always run; they never send anything anywhere.
|
|
140
142
|
|
|
141
143
|
Detection is pattern-based, so it is fast and needs no build, but it can miss crypto hidden inside
|
|
142
144
|
compiled binaries or wrapper functions, and it can report false positives. Findings carry a
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cbomly"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
8
8
|
description = "Find the cryptography in your software, write a CycloneDX CBOM, and check it is quantum-safe."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -12,6 +12,7 @@ import hashlib
|
|
|
12
12
|
import uuid
|
|
13
13
|
from collections import OrderedDict
|
|
14
14
|
from datetime import UTC, datetime
|
|
15
|
+
from urllib.parse import quote
|
|
15
16
|
|
|
16
17
|
from . import __version__, algorithms, inventory
|
|
17
18
|
from .cbom_names import display_name
|
|
@@ -70,6 +71,18 @@ def _algorithm_component(name: str, alg: algorithms.Algorithm, group: list[Findi
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
|
|
74
|
+
def _ref_plain(kind: str, key: str) -> str:
|
|
75
|
+
return f"{kind}/{hashlib.sha1(key.encode()).hexdigest()[:12]}"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _where(p: dict) -> str:
|
|
79
|
+
return f"{p['file']}:{p['line']}" if p.get("line") else p["file"]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _loc(p: dict) -> dict:
|
|
83
|
+
return {"location": p["file"], **({"line": p["line"]} if p.get("line") else {})}
|
|
84
|
+
|
|
85
|
+
|
|
73
86
|
def _props(alg: algorithms.Algorithm, status: str) -> list[dict]:
|
|
74
87
|
return [
|
|
75
88
|
{"name": "cbomly:status", "value": status},
|
|
@@ -80,7 +93,8 @@ def _props(alg: algorithms.Algorithm, status: str) -> list[dict]:
|
|
|
80
93
|
|
|
81
94
|
|
|
82
95
|
def build(findings: list[Finding], sbom: dict | None, target_name: str, crypto_libs: list[dict] | None = None,
|
|
83
|
-
tool_versions: dict | None = None, services: list[dict] | None = None
|
|
96
|
+
tool_versions: dict | None = None, services: list[dict] | None = None, ai_inv: dict | None = None,
|
|
97
|
+
vendor_inv: list[dict] | None = None) -> dict:
|
|
84
98
|
now = datetime.now(UTC).replace(microsecond=0).isoformat().replace("+00:00", "Z")
|
|
85
99
|
bom: dict = {
|
|
86
100
|
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
|
|
@@ -207,6 +221,60 @@ def build(findings: list[Finding], sbom: dict | None, target_name: str, crypto_l
|
|
|
207
221
|
bom.setdefault("services", []).append(e)
|
|
208
222
|
e["properties"].append({"name": "cbomly:location", "value": f"{svc['file']}:{svc['line']}"})
|
|
209
223
|
|
|
224
|
+
# 6. other third-party services (vendor inventory)
|
|
225
|
+
for v in vendor_inv or []:
|
|
226
|
+
if v["service"] in seen_svc:
|
|
227
|
+
continue
|
|
228
|
+
props = [{"name": "cbomly:service-category", "value": v["category"]}]
|
|
229
|
+
props += [{"name": "cbomly:location", "value": _where(p)} for p in v["places"]]
|
|
230
|
+
props += [{"name": "cbomly:package", "value": p} for p in v["packages"]]
|
|
231
|
+
e = {"bom-ref": _ref_plain("service", f"{v['vendor']}/{v['service']}"), "provider": {"name": v["vendor"]},
|
|
232
|
+
"name": v["service"], "x-trust-boundary": True, "properties": props}
|
|
233
|
+
seen_svc[v["service"]] = e
|
|
234
|
+
bom.setdefault("services", []).append(e)
|
|
235
|
+
other_refs = [e["bom-ref"] for e in seen_svc.values()]
|
|
236
|
+
|
|
237
|
+
# 7. AI: libraries (tag SBOM components, or add them) and models
|
|
238
|
+
by_ref = {c.get("bom-ref"): c for c in bom["components"]}
|
|
239
|
+
for lib in (ai_inv or {}).get("libraries", []):
|
|
240
|
+
tags = [{"name": "cbomly:ai-library", "value": lib["name"]}, {"name": "cbomly:ai-role", "value": lib["role"]}]
|
|
241
|
+
tagged = [by_ref[r] for r in lib["bom_refs"] if r in by_ref]
|
|
242
|
+
for c in tagged:
|
|
243
|
+
c.setdefault("properties", []).extend(tags)
|
|
244
|
+
if not tagged:
|
|
245
|
+
ref = _ref_plain("ai/library", lib["name"])
|
|
246
|
+
comp = {"type": "library", "name": lib["name"], "bom-ref": ref, "properties": tags}
|
|
247
|
+
if lib["places"]:
|
|
248
|
+
comp["evidence"] = {"occurrences": [_loc(p) for p in lib["places"]]}
|
|
249
|
+
bom["components"].append(comp)
|
|
250
|
+
other_refs.append(ref)
|
|
251
|
+
for m in (ai_inv or {}).get("models", []):
|
|
252
|
+
ref = _ref_plain("ai/model", f"{m['kind']}:{m['name']}:{m['places'][0]['file']}" if m["kind"] == "file" else f"{m['kind']}:{m['name']}")
|
|
253
|
+
source = {"file": "file", "huggingface": "huggingface-hub", "hosted": "hosted-api", "local": "local-runtime"}[m["kind"]]
|
|
254
|
+
props = [{"name": "cbomly:ai-model-source", "value": source}]
|
|
255
|
+
comp = {"type": "machine-learning-model", "name": m["name"], "bom-ref": ref}
|
|
256
|
+
if m["kind"] == "file":
|
|
257
|
+
props.append({"name": "cbomly:model-format", "value": m["format"]})
|
|
258
|
+
if m["pickle"]:
|
|
259
|
+
props.append({"name": "cbomly:pickle-format", "value": "true"})
|
|
260
|
+
if m.get("size"):
|
|
261
|
+
props.append({"name": "cbomly:size-bytes", "value": str(m["size"])})
|
|
262
|
+
if m.get("sha256"):
|
|
263
|
+
comp["hashes"] = [{"alg": "SHA-256", "content": m["sha256"]}]
|
|
264
|
+
else:
|
|
265
|
+
comp["supplier"] = {"name": m["supplier"]}
|
|
266
|
+
if m["kind"] == "huggingface":
|
|
267
|
+
org, _, model = m["name"].partition("/")
|
|
268
|
+
comp["group"] = org
|
|
269
|
+
comp["purl"] = f"pkg:huggingface/{quote(org)}/{quote(model)}"
|
|
270
|
+
if m.get("runtime"):
|
|
271
|
+
props.append({"name": "cbomly:ai-runtime", "value": m["runtime"]})
|
|
272
|
+
comp["evidence"] = {"occurrences": [_loc(p) for p in m["places"]]}
|
|
273
|
+
comp["properties"] = props
|
|
274
|
+
bom["components"].append(comp)
|
|
275
|
+
other_refs.append(ref)
|
|
276
|
+
|
|
277
|
+
crypto_refs += other_refs
|
|
210
278
|
if crypto_refs:
|
|
211
279
|
existing = next((d for d in bom["dependencies"] if d.get("ref") == root_ref), None)
|
|
212
280
|
if existing is None:
|
|
@@ -10,7 +10,7 @@ from datetime import UTC, datetime
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
from . import __version__, algorithms, cbom, inventory, report, rules, sbom, scanner
|
|
13
|
-
from .detect import deps
|
|
13
|
+
from .detect import ai, deps, vendors
|
|
14
14
|
from .rules import SEVERITIES
|
|
15
15
|
|
|
16
16
|
|
|
@@ -26,7 +26,7 @@ def _parser() -> argparse.ArgumentParser:
|
|
|
26
26
|
s.add_argument("-o", "--out", default="cbomly-out", help="output folder (default: ./cbomly-out)")
|
|
27
27
|
s.add_argument("--name", help="product name to put in the reports (default: folder name)")
|
|
28
28
|
s.add_argument("--no-sbom", action="store_true", help="skip the Syft software list; crypto only")
|
|
29
|
-
s.add_argument("--syft", help="path to the syft binary (default:
|
|
29
|
+
s.add_argument("--syft", help="path to the syft binary (default: $CBOMLY_SYFT, PATH, or downloaded on first use)")
|
|
30
30
|
s.add_argument("--exclude", action="append", default=[], help="extra file/folder name pattern to skip (repeatable)")
|
|
31
31
|
s.add_argument("--include-vendored", action="store_true", help="also scan node_modules, vendor, venv and build folders")
|
|
32
32
|
s.add_argument("--fail-on", choices=SEVERITIES[:-1], help="exit with code 1 if any issue is this severe or worse (for CI)")
|
|
@@ -76,14 +76,14 @@ def cmd_scan(a) -> int:
|
|
|
76
76
|
base = [".git", ".hg", ".svn", "cbomly-out"] if a.include_vendored else list(scanner.DEFAULT_EXCLUDES)
|
|
77
77
|
excludes = base + a.exclude + [Path(a.out).name]
|
|
78
78
|
|
|
79
|
-
log(f"Scanning {target} for cryptography…")
|
|
79
|
+
log(f"Scanning {target} for cryptography, AI and third-party services…")
|
|
80
80
|
findings, stats = scanner.scan_path(target, excludes)
|
|
81
81
|
log(f" {stats.files_scanned} files read, {len(findings)} crypto uses found")
|
|
82
82
|
|
|
83
83
|
sb = None
|
|
84
84
|
tool_versions = {}
|
|
85
85
|
if not a.no_sbom:
|
|
86
|
-
syft = sbom.
|
|
86
|
+
syft = sbom.ensure_syft(a.syft, log)
|
|
87
87
|
if not syft:
|
|
88
88
|
log(sbom.INSTALL_HINT)
|
|
89
89
|
notes.append("Syft was not installed, so no software list (SBOM) was produced.")
|
|
@@ -105,22 +105,28 @@ def write_outputs(a, name, packs, findings, sb, stats, notes, tool_versions, sou
|
|
|
105
105
|
"""Shared by `scan` and `import`: evaluate rules, write the three output files, print the summary."""
|
|
106
106
|
libs = deps.crypto_libraries(sb)
|
|
107
107
|
ev = rules.evaluate(packs, findings, sb)
|
|
108
|
-
|
|
108
|
+
ai_inv = ai.inventory(stats.ai_models, stats.ai_libs + ai.libs_from_sbom(sb))
|
|
109
|
+
hub = [{"vendor": "Hugging Face", "service": "Hugging Face Hub and Inference", "category": "ai", "source": "code",
|
|
110
|
+
"file": m["file"], "line": m["line"]} for m in stats.ai_models if m["kind"] == "huggingface"]
|
|
111
|
+
vendor_inv = vendors.inventory(stats.vendors + hub + vendors.from_sbom(sb), stats.services)
|
|
112
|
+
bom = cbom.build(findings, sb, name, libs, tool_versions, stats.services, ai_inv, vendor_inv)
|
|
109
113
|
n_sw = len(sb.get("components", [])) if sb else None
|
|
110
114
|
|
|
111
115
|
out = Path(a.out)
|
|
112
116
|
out.mkdir(parents=True, exist_ok=True)
|
|
113
117
|
(out / "cbom.cdx.json").write_text(json.dumps(bom, indent=2) + "\n", encoding="utf-8")
|
|
114
|
-
summary = report.markdown(name, findings, ev, libs, n_sw, notes, stats.services)
|
|
118
|
+
summary = report.markdown(name, findings, ev, libs, n_sw, notes, stats.services, ai_inv, vendor_inv)
|
|
115
119
|
(out / "summary.md").write_text(summary, encoding="utf-8")
|
|
116
120
|
doc = results_doc(name, findings, ev, libs, n_sw, stats)
|
|
121
|
+
doc["ai"] = ai_inv
|
|
122
|
+
doc["third_party_services"] = vendor_inv
|
|
117
123
|
doc["source"] = source or {"type": "scan"}
|
|
118
124
|
(out / "findings.json").write_text(json.dumps(doc, indent=2) + "\n", encoding="utf-8")
|
|
119
125
|
|
|
120
126
|
if not a.quiet:
|
|
121
127
|
color = sys.stdout.isatty() and not a.no_color and not os.environ.get("NO_COLOR")
|
|
122
128
|
title = "Cbomly import complete" if source and source.get("type") == "import" else "Cbomly scan complete"
|
|
123
|
-
print(report.terminal(findings, ev, str(out), color, title))
|
|
129
|
+
print(report.terminal(findings, ev, str(out), color, title, ai_inv, vendor_inv))
|
|
124
130
|
|
|
125
131
|
if a.fail_on:
|
|
126
132
|
worst = ev.worst_severity()
|
|
@@ -222,8 +228,11 @@ def cmd_doctor(_a) -> int:
|
|
|
222
228
|
print(f"python {sys.version.split()[0]}")
|
|
223
229
|
if syft:
|
|
224
230
|
print(f"syft {sbom.syft_version(syft) or 'found'} ({syft})")
|
|
231
|
+
elif not sbom.syft_fetch.disabled():
|
|
232
|
+
print(f"syft not installed; `cbomly scan` downloads Syft {sbom.syft_fetch.SYFT_VERSION} on first use")
|
|
233
|
+
return 0
|
|
225
234
|
else:
|
|
226
|
-
print("syft NOT FOUND")
|
|
235
|
+
print("syft NOT FOUND (CBOMLY_NO_SYFT is set, so it won't be downloaded)")
|
|
227
236
|
print(sbom.INSTALL_HINT)
|
|
228
237
|
return 0 if syft else 1
|
|
229
238
|
|