cbomly 0.3.1__tar.gz → 0.5.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.
Files changed (60) hide show
  1. {cbomly-0.3.1/src/cbomly.egg-info → cbomly-0.5.0}/PKG-INFO +30 -14
  2. {cbomly-0.3.1 → cbomly-0.5.0}/README.md +29 -13
  3. {cbomly-0.3.1 → cbomly-0.5.0}/pyproject.toml +1 -1
  4. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/__init__.py +1 -1
  5. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/algorithms.py +70 -0
  6. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/cbom.py +72 -4
  7. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/cli.py +101 -11
  8. cbomly-0.5.0/src/cbomly/detect/ai.py +298 -0
  9. cbomly-0.5.0/src/cbomly/detect/binary.py +93 -0
  10. cbomly-0.5.0/src/cbomly/detect/configs.py +396 -0
  11. cbomly-0.5.0/src/cbomly/detect/deps.py +148 -0
  12. cbomly-0.5.0/src/cbomly/detect/keys.py +917 -0
  13. cbomly-0.5.0/src/cbomly/detect/manifest.py +97 -0
  14. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/detect/source.py +211 -2
  15. cbomly-0.5.0/src/cbomly/detect/vendors.py +313 -0
  16. cbomly-0.5.0/src/cbomly/image.py +268 -0
  17. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/inventory.py +1 -1
  18. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/report.py +86 -5
  19. cbomly-0.5.0/src/cbomly/scanner.py +116 -0
  20. cbomly-0.5.0/src/cbomly/tlscheck.py +191 -0
  21. {cbomly-0.3.1 → cbomly-0.5.0/src/cbomly.egg-info}/PKG-INFO +30 -14
  22. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly.egg-info/SOURCES.txt +8 -0
  23. {cbomly-0.3.1 → cbomly-0.5.0}/tests/test_cli.py +23 -3
  24. cbomly-0.5.0/tests/test_formats.py +64 -0
  25. cbomly-0.3.1/src/cbomly/detect/deps.py +0 -81
  26. cbomly-0.3.1/src/cbomly/detect/keys.py +0 -319
  27. cbomly-0.3.1/src/cbomly/scanner.py +0 -77
  28. {cbomly-0.3.1 → cbomly-0.5.0}/LICENSE +0 -0
  29. {cbomly-0.3.1 → cbomly-0.5.0}/NOTICE +0 -0
  30. {cbomly-0.3.1 → cbomly-0.5.0}/setup.cfg +0 -0
  31. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/__main__.py +0 -0
  32. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/cbom_names.py +0 -0
  33. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/detect/__init__.py +0 -0
  34. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/detect/services.py +0 -0
  35. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/findings.py +0 -0
  36. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/importer.py +0 -0
  37. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/au.toml +0 -0
  38. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/baseline.toml +0 -0
  39. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/ca.toml +0 -0
  40. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/eu.toml +0 -0
  41. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/india.toml +0 -0
  42. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/jp.toml +0 -0
  43. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/pci-dss.toml +0 -0
  44. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/sg.toml +0 -0
  45. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/uk.toml +0 -0
  46. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/us-cnsa2.toml +0 -0
  47. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/us-fda.toml +0 -0
  48. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/packs/us.toml +0 -0
  49. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/rules.py +0 -0
  50. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/sbom.py +0 -0
  51. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/syft_fetch.py +0 -0
  52. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly/upload.py +0 -0
  53. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly.egg-info/dependency_links.txt +0 -0
  54. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly.egg-info/entry_points.txt +0 -0
  55. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly.egg-info/requires.txt +0 -0
  56. {cbomly-0.3.1 → cbomly-0.5.0}/src/cbomly.egg-info/top_level.txt +0 -0
  57. {cbomly-0.3.1 → cbomly-0.5.0}/tests/test_keys.py +0 -0
  58. {cbomly-0.3.1 → cbomly-0.5.0}/tests/test_rules.py +0 -0
  59. {cbomly-0.3.1 → cbomly-0.5.0}/tests/test_source.py +0 -0
  60. {cbomly-0.3.1 → cbomly-0.5.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.1
3
+ Version: 0.5.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**) and a plain-English report that says what a future quantum
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
@@ -107,8 +107,12 @@ cbomly scan . --exclude 'testdata' # skip folders or files by name pattern
107
107
  cbomly rules # list rule packs
108
108
  cbomly rules india # show the rules in a pack
109
109
  cbomly import cbom.json -r india # use a CBOM from IBM CBOMkit, cdxgen or another tool instead of scanning
110
+ cbomly scan nginx:1.27 # scan a container image (public registry, local Docker/Podman, or a `docker save` .tar)
111
+ cbomly tls example.com # check a live server you run: TLS versions, post-quantum key exchange, certificates
110
112
  ```
111
113
 
114
+ `cbomly tls` makes ordinary handshakes, like a browser. Only point it at servers you run or are allowed to test.
115
+
112
116
  **Already have a CBOM?** `cbomly import` reads any CycloneDX 1.6+ CBOM, for example from IBM's
113
117
  CBOMkit / Sonar Cryptography plugin or cdxgen. It maps each `cryptographic-asset` (algorithms, keys,
114
118
  certificates, protocols) to Cbomly's catalog by OID or name, keeps the software components as the SBOM, and
@@ -119,9 +123,9 @@ Output goes to `./cbomly-out/`:
119
123
 
120
124
  | File | What it is |
121
125
  |---|---|
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`), and crypto services (KMS, HSM, CA) under `services` |
123
- | `summary.md` | The readable report: what is quantum-vulnerable, where, what to do, the full crypto inventory, and vendors |
124
- | `findings.json` | Findings, rule results, inventory and vendors, for scripts and `cbomly upload` |
126
+ | `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` |
127
+ | `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 |
128
+ | `findings.json` | Findings, rule results, inventory, AI (`ai`) and vendor inventory (`third_party_services`), for scripts and `cbomly upload` |
125
129
 
126
130
  ## Dashboard and CI
127
131
 
@@ -149,21 +153,33 @@ the trend view, alerts for new RSA/ECC and the release gate.
149
153
 
150
154
  | Where | How |
151
155
  |---|---|
152
- | Source code: Python, Java/Kotlin, Go, JavaScript/TypeScript, C/C++, C#, Ruby, PHP, Rust, Swift | Known crypto API calls (e.g. `KeyPairGenerator.getInstance("RSA")`, `rsa.generate_private_key`, `crypto.subtle`, OpenSSL `EVP_*`), including key sizes and curves where written in the code |
153
- | Config files: nginx/Apache, YAML, TOML, properties, JSON | TLS versions, cipher suites, JWT algorithms (`RS256`, `ES256`) |
154
- | Keys and certificates: PEM, DER, SSH keys | Algorithm, key size, curve, signature hash, subject and validity dates. Private keys are flagged as leaks |
155
- | Dependencies (via Syft) | Crypto libraries such as OpenSSL, Bouncy Castle and Go's standard library, and whether the version supports post-quantum algorithms |
156
- | Post-quantum use | ML-KEM, ML-DSA, SLH-DSA and hybrid X25519MLKEM768 are recognised and reported as good news |
156
+ | Source code: Python, Java/Kotlin/Scala, Go, JavaScript/TypeScript, C/C++/Objective-C, C#, Ruby, PHP, Rust, Swift, Dart, Elixir/Erlang | Known crypto API calls, including key sizes and curves where written in the code. Covers the standard libraries plus Bouncy Castle (classic and PQC), OpenSSL, BoringSSL, wolfSSL, Mbed TLS, Botan, libgcrypt, libsodium, CommonCrypto and CryptoKit, ring, rustls, aws-lc-rs, RustCrypto, PyCryptodome, PyNaCl, paramiko, liboqs, crypto-js, noble, jsrsasign, phpseclib, pointycastle and Erlang `:crypto` |
157
+ | Post-quantum APIs | Java 24 ML-KEM/ML-DSA, .NET 10 `MLKem`/`MLDsa`/`SlhDsa`, Apple CryptoKit ML-KEM/ML-DSA/X-Wing, Go `crypto/mlkem`, Bouncy Castle, liboqs, LMS/XMSS, FN-DSA (Falcon), HQC, FrodoKEM, Classic McEliece, composite ML-DSA and hybrid key exchange (X25519MLKEM768, SecP256r1MLKEM768, mlkem768x25519-sha256, sntrup761) |
158
+ | Web, proxy and app server configs | nginx, Apache, HAProxy, Caddy, Envoy, Traefik, Postfix, OpenSSL `openssl.cnf`, Java `java.security`, Spring Boot: TLS versions, cipher suites and key exchange groups, and whether a post-quantum hybrid group is on |
159
+ | SSH | `sshd_config`/`ssh_config` key exchange, host key, cipher and MAC lists; host keys, `authorized_keys`, `known_hosts` |
160
+ | VPN | WireGuard (warns when no PresharedKey), strongSwan/libreswan IKE and ESP proposals (including ML-KEM), OpenVPN cipher, auth, minimum TLS version and DH size |
161
+ | Infrastructure as code | Terraform, CloudFormation and Bicep: `tls_private_key`, AWS/Google/Azure KMS key specs (including ML-DSA), ACM key algorithms, load balancer TLS policies (post-quantum and TLS 1.0/1.1 policies), CloudFront, API Gateway and Azure minimum TLS versions. Kubernetes: cert-manager certificates, Ingress TLS annotations, Istio minimum TLS, and TLS Secrets |
162
+ | Keys and certificates | PEM, DER, PKCS#7 chains, CSRs, PKCS#8 (including how encrypted keys are protected), OpenSSH, PuTTY `.ppk`, OpenPGP/GPG, JWK/JWKS, Java keystores (JKS, JCEKS: certificates are read without the password), PKCS#12 `.p12`/`.pfx` (protection scheme; contents too if the password is empty or a common default and `cryptography` is installed). Algorithm, key size, curve, signature hash, subject and validity dates. Private keys are flagged as leaks |
163
+ | Container images | Every layer of a public image, an image in your local Docker/Podman, or a `docker save` archive. The system CA trust store is counted, not listed |
164
+ | Compiled binaries | Crypto library versions built into ELF, PE and Mach-O files (OpenSSL, LibreSSL, BoringSSL, AWS-LC, wolfSSL, Mbed TLS, GnuTLS, OpenSSH, Dropbear, libsodium, liboqs, Go) and well-known algorithm constants |
165
+ | Live servers (`cbomly tls`) | Accepted TLS versions, supported key exchange groups including X25519MLKEM768, negotiated cipher and the certificate chain |
166
+ | Dependencies (via Syft) | Over 40 crypto library families and runtimes (OpenSSL, Bouncy Castle, wolfSSL, AWS-LC, Tink, libsodium, OpenSSH, Java, .NET, Go and more), with whether the version supports post-quantum algorithms. Abandoned libraries such as PyCrypto and crypto-js are called out |
157
167
  | 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 |
168
+ | 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 |
169
+ | 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 |
170
+ | 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 |
171
+ | Weak and broken crypto | MD4, MD5, SHA-1, DES, 3DES, RC2, RC4, Blowfish, IDEA, CAST5, ECB mode, SSL 3.0, TLS 1.0/1.1, JWT `none`, XML-signature `rsa-sha1` (SAML), legacy PKCS#12 encryption |
158
172
  | 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" |
159
173
 
160
174
  Every algorithm, certificate, key and protocol gets one status: **broken**, **deprecated**,
161
175
  **quantum-vulnerable**, **weakened** (by quantum attacks, e.g. AES-128) or **safe**. Certificates also
162
- show issuer, public key, signature and expiry. Keys show size or curve. The **Vendors** section lists
176
+ show issuer, public key, signature and expiry. Keys show size or curve. The **Crypto vendors** section lists
163
177
  who supplies or controls your crypto: library makers, certificate issuers, and key management services.
178
+ AI detection and the vendor inventory always run; they never send anything anywhere.
164
179
 
165
- Detection is pattern-based, so it is fast and needs no build, but it can miss crypto hidden inside
166
- compiled binaries or wrapper functions, and it can report false positives. Findings carry a
180
+ Detection is pattern-based, so it is fast and needs no build, but it can miss crypto hidden behind
181
+ wrapper functions, and it can report false positives. Constants found in binaries show an algorithm is
182
+ compiled in, not that it is used. Findings carry a
167
183
  confidence level (high, medium, low).
168
184
 
169
185
  ## Rule packs
@@ -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**) and a plain-English report that says what a future quantum
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
@@ -81,8 +81,12 @@ cbomly scan . --exclude 'testdata' # skip folders or files by name pattern
81
81
  cbomly rules # list rule packs
82
82
  cbomly rules india # show the rules in a pack
83
83
  cbomly import cbom.json -r india # use a CBOM from IBM CBOMkit, cdxgen or another tool instead of scanning
84
+ cbomly scan nginx:1.27 # scan a container image (public registry, local Docker/Podman, or a `docker save` .tar)
85
+ cbomly tls example.com # check a live server you run: TLS versions, post-quantum key exchange, certificates
84
86
  ```
85
87
 
88
+ `cbomly tls` makes ordinary handshakes, like a browser. Only point it at servers you run or are allowed to test.
89
+
86
90
  **Already have a CBOM?** `cbomly import` reads any CycloneDX 1.6+ CBOM, for example from IBM's
87
91
  CBOMkit / Sonar Cryptography plugin or cdxgen. It maps each `cryptographic-asset` (algorithms, keys,
88
92
  certificates, protocols) to Cbomly's catalog by OID or name, keeps the software components as the SBOM, and
@@ -93,9 +97,9 @@ Output goes to `./cbomly-out/`:
93
97
 
94
98
  | File | What it is |
95
99
  |---|---|
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`), and crypto services (KMS, HSM, CA) under `services` |
97
- | `summary.md` | The readable report: what is quantum-vulnerable, where, what to do, the full crypto inventory, and vendors |
98
- | `findings.json` | Findings, rule results, inventory and vendors, for scripts and `cbomly upload` |
100
+ | `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` |
101
+ | `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 |
102
+ | `findings.json` | Findings, rule results, inventory, AI (`ai`) and vendor inventory (`third_party_services`), for scripts and `cbomly upload` |
99
103
 
100
104
  ## Dashboard and CI
101
105
 
@@ -123,21 +127,33 @@ the trend view, alerts for new RSA/ECC and the release gate.
123
127
 
124
128
  | Where | How |
125
129
  |---|---|
126
- | Source code: Python, Java/Kotlin, Go, JavaScript/TypeScript, C/C++, C#, Ruby, PHP, Rust, Swift | Known crypto API calls (e.g. `KeyPairGenerator.getInstance("RSA")`, `rsa.generate_private_key`, `crypto.subtle`, OpenSSL `EVP_*`), including key sizes and curves where written in the code |
127
- | Config files: nginx/Apache, YAML, TOML, properties, JSON | TLS versions, cipher suites, JWT algorithms (`RS256`, `ES256`) |
128
- | Keys and certificates: PEM, DER, SSH keys | Algorithm, key size, curve, signature hash, subject and validity dates. Private keys are flagged as leaks |
129
- | Dependencies (via Syft) | Crypto libraries such as OpenSSL, Bouncy Castle and Go's standard library, and whether the version supports post-quantum algorithms |
130
- | Post-quantum use | ML-KEM, ML-DSA, SLH-DSA and hybrid X25519MLKEM768 are recognised and reported as good news |
130
+ | Source code: Python, Java/Kotlin/Scala, Go, JavaScript/TypeScript, C/C++/Objective-C, C#, Ruby, PHP, Rust, Swift, Dart, Elixir/Erlang | Known crypto API calls, including key sizes and curves where written in the code. Covers the standard libraries plus Bouncy Castle (classic and PQC), OpenSSL, BoringSSL, wolfSSL, Mbed TLS, Botan, libgcrypt, libsodium, CommonCrypto and CryptoKit, ring, rustls, aws-lc-rs, RustCrypto, PyCryptodome, PyNaCl, paramiko, liboqs, crypto-js, noble, jsrsasign, phpseclib, pointycastle and Erlang `:crypto` |
131
+ | Post-quantum APIs | Java 24 ML-KEM/ML-DSA, .NET 10 `MLKem`/`MLDsa`/`SlhDsa`, Apple CryptoKit ML-KEM/ML-DSA/X-Wing, Go `crypto/mlkem`, Bouncy Castle, liboqs, LMS/XMSS, FN-DSA (Falcon), HQC, FrodoKEM, Classic McEliece, composite ML-DSA and hybrid key exchange (X25519MLKEM768, SecP256r1MLKEM768, mlkem768x25519-sha256, sntrup761) |
132
+ | Web, proxy and app server configs | nginx, Apache, HAProxy, Caddy, Envoy, Traefik, Postfix, OpenSSL `openssl.cnf`, Java `java.security`, Spring Boot: TLS versions, cipher suites and key exchange groups, and whether a post-quantum hybrid group is on |
133
+ | SSH | `sshd_config`/`ssh_config` key exchange, host key, cipher and MAC lists; host keys, `authorized_keys`, `known_hosts` |
134
+ | VPN | WireGuard (warns when no PresharedKey), strongSwan/libreswan IKE and ESP proposals (including ML-KEM), OpenVPN cipher, auth, minimum TLS version and DH size |
135
+ | Infrastructure as code | Terraform, CloudFormation and Bicep: `tls_private_key`, AWS/Google/Azure KMS key specs (including ML-DSA), ACM key algorithms, load balancer TLS policies (post-quantum and TLS 1.0/1.1 policies), CloudFront, API Gateway and Azure minimum TLS versions. Kubernetes: cert-manager certificates, Ingress TLS annotations, Istio minimum TLS, and TLS Secrets |
136
+ | Keys and certificates | PEM, DER, PKCS#7 chains, CSRs, PKCS#8 (including how encrypted keys are protected), OpenSSH, PuTTY `.ppk`, OpenPGP/GPG, JWK/JWKS, Java keystores (JKS, JCEKS: certificates are read without the password), PKCS#12 `.p12`/`.pfx` (protection scheme; contents too if the password is empty or a common default and `cryptography` is installed). Algorithm, key size, curve, signature hash, subject and validity dates. Private keys are flagged as leaks |
137
+ | Container images | Every layer of a public image, an image in your local Docker/Podman, or a `docker save` archive. The system CA trust store is counted, not listed |
138
+ | Compiled binaries | Crypto library versions built into ELF, PE and Mach-O files (OpenSSL, LibreSSL, BoringSSL, AWS-LC, wolfSSL, Mbed TLS, GnuTLS, OpenSSH, Dropbear, libsodium, liboqs, Go) and well-known algorithm constants |
139
+ | Live servers (`cbomly tls`) | Accepted TLS versions, supported key exchange groups including X25519MLKEM768, negotiated cipher and the certificate chain |
140
+ | Dependencies (via Syft) | Over 40 crypto library families and runtimes (OpenSSL, Bouncy Castle, wolfSSL, AWS-LC, Tink, libsodium, OpenSSH, Java, .NET, Go and more), with whether the version supports post-quantum algorithms. Abandoned libraries such as PyCrypto and crypto-js are called out |
131
141
  | 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 |
142
+ | 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 |
143
+ | 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 |
144
+ | 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 |
145
+ | Weak and broken crypto | MD4, MD5, SHA-1, DES, 3DES, RC2, RC4, Blowfish, IDEA, CAST5, ECB mode, SSL 3.0, TLS 1.0/1.1, JWT `none`, XML-signature `rsa-sha1` (SAML), legacy PKCS#12 encryption |
132
146
  | 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" |
133
147
 
134
148
  Every algorithm, certificate, key and protocol gets one status: **broken**, **deprecated**,
135
149
  **quantum-vulnerable**, **weakened** (by quantum attacks, e.g. AES-128) or **safe**. Certificates also
136
- show issuer, public key, signature and expiry. Keys show size or curve. The **Vendors** section lists
150
+ show issuer, public key, signature and expiry. Keys show size or curve. The **Crypto vendors** section lists
137
151
  who supplies or controls your crypto: library makers, certificate issuers, and key management services.
152
+ AI detection and the vendor inventory always run; they never send anything anywhere.
138
153
 
139
- Detection is pattern-based, so it is fast and needs no build, but it can miss crypto hidden inside
140
- compiled binaries or wrapper functions, and it can report false positives. Findings carry a
154
+ Detection is pattern-based, so it is fast and needs no build, but it can miss crypto hidden behind
155
+ wrapper functions, and it can report false positives. Constants found in binaries show an algorithm is
156
+ compiled in, not that it is used. Findings carry a
141
157
  confidence level (high, medium, low).
142
158
 
143
159
  ## Rule packs
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cbomly"
7
- version = "0.3.1"
7
+ version = "0.5.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"
@@ -1,3 +1,3 @@
1
1
  """Cbomly: find the cryptography in your software and check it is quantum-safe."""
2
2
 
3
- __version__ = "0.3.1"
3
+ __version__ = "0.5.0"
@@ -103,6 +103,25 @@ CATALOG: dict[str, Algorithm] = {a.id: a for a in [
103
103
  _A("hybrid-kem", "Hybrid X25519MLKEM768", "kem", "resistant", "acceptable",
104
104
  "Keep.", "Classical + post-quantum hybrid key exchange (TLS 1.3).",
105
105
  nist_quantum_level=3),
106
+ _A("hybrid-sig", "Composite / hybrid ML-DSA signature", "signature", "resistant", "acceptable",
107
+ "Keep.", "Classical + ML-DSA composite signature (IETF LAMPS draft).", nist_quantum_level=3),
108
+ _A("fn-dsa", "FN-DSA (Falcon)", "signature", "resistant", "acceptable",
109
+ "Keep; FIPS 206 is still a draft, so plan to re-check parameters.",
110
+ "NIST's lattice signature selected for standardisation as FN-DSA.", nist_quantum_level=1,
111
+ aliases=("falcon",)),
112
+ _A("hqc", "HQC", "kem", "resistant", "acceptable",
113
+ "Keep as a backup KEM; ML-KEM is the primary standard.",
114
+ "Code-based KEM selected by NIST in 2025 as a backup to ML-KEM.", nist_quantum_level=1),
115
+ _A("frodokem", "FrodoKEM", "kem", "resistant", "acceptable",
116
+ "Keep; recommended by BSI and ANSSI, not a NIST standard.", "Conservative lattice KEM.",
117
+ nist_quantum_level=1),
118
+ _A("mceliece", "Classic McEliece", "kem", "resistant", "acceptable",
119
+ "Keep; very large public keys.", "Code-based KEM; ISO standardisation in progress.",
120
+ nist_quantum_level=1),
121
+ _A("sntrup", "Hybrid sntrup761x25519 (SSH)", "kem", "resistant", "acceptable",
122
+ "Keep, or move to mlkem768x25519-sha256 (OpenSSH 10 default).",
123
+ "Streamlined NTRU Prime + X25519 hybrid key exchange used by OpenSSH since 9.0.",
124
+ nist_quantum_level=1),
106
125
 
107
126
  # --- Hashes -------------------------------------------------------
108
127
  _A("md5", "MD5", "hash", "not-applicable", "broken",
@@ -142,6 +161,22 @@ CATALOG: dict[str, Algorithm] = {a.id: a for a in [
142
161
  "Biased keystream; banned in TLS (RFC 7465)."),
143
162
  _A("ecb", "ECB mode", "block-cipher", "not-applicable", "broken", "GCM or another authenticated mode",
144
163
  "ECB leaks patterns in the plaintext."),
164
+ _A("blowfish", "Blowfish", "block-cipher", "not-applicable", "deprecated", "AES-256",
165
+ "64-bit block size (Sweet32 attacks); not approved by NIST."),
166
+ _A("rc2", "RC2", "block-cipher", "not-applicable", "broken", "AES-256",
167
+ "Weak cipher, often with 40-bit keys (for example in legacy PKCS#12 files)."),
168
+ _A("idea", "IDEA", "block-cipher", "not-applicable", "deprecated", "AES-256",
169
+ "64-bit block size; removed from modern TLS."),
170
+ _A("cast5", "CAST5", "block-cipher", "not-applicable", "deprecated", "AES-256",
171
+ "64-bit block size; legacy OpenPGP default."),
172
+ _A("md4", "MD4", "hash", "not-applicable", "broken", "SHA-256 or SHA-3",
173
+ "Collisions can be found by hand; never use."),
174
+ _A("jwt-none", "JWT \"none\" algorithm", "signature", "not-applicable", "broken",
175
+ "RS/ES/EdDSA, or ML-DSA when JOSE support lands",
176
+ "An unsigned JWT can be forged by anyone.", asset_type="protocol"),
177
+ _A("unknown-key", "Key (algorithm not readable)", "other", "not-applicable", "acceptable",
178
+ "Inspect the key to confirm its algorithm and size.",
179
+ "The key is encrypted or in a format the scanner cannot read without a password."),
145
180
  _A("chacha20", "ChaCha20-Poly1305", "ae", "resistant", "acceptable", "Keep.",
146
181
  "256-bit key; fine against quantum attacks.", classical_security_bits=256, nist_quantum_level=5),
147
182
  _A("hmac", "HMAC", "mac", "resistant", "acceptable", "Keep (with SHA-256 or better).", "",
@@ -162,6 +197,10 @@ CATALOG: dict[str, Algorithm] = {a.id: a for a in [
162
197
  "Deprecated by RFC 8996.", asset_type="protocol"),
163
198
  _A("tls1.1", "TLS 1.1", "other", "not-applicable", "broken", "TLS 1.3",
164
199
  "Deprecated by RFC 8996.", asset_type="protocol"),
200
+ _A("tls1.2", "TLS 1.2", "other", "not-applicable", "acceptable", "TLS 1.3 with hybrid X25519MLKEM768",
201
+ "Fine today; post-quantum hybrid key exchange needs TLS 1.3.", asset_type="protocol"),
202
+ _A("tls1.3", "TLS 1.3", "other", "not-applicable", "acceptable", "Keep; enable X25519MLKEM768",
203
+ "Current version; supports post-quantum hybrid key exchange.", asset_type="protocol"),
165
204
  _A("sslv3", "SSL 3.0", "other", "not-applicable", "broken", "TLS 1.3",
166
205
  "Broken (POODLE).", asset_type="protocol"),
167
206
  ]}
@@ -209,6 +248,37 @@ OIDS: dict[str, tuple[str, str | None]] = {
209
248
  }
210
249
  for _n in range(20, 32):
211
250
  OIDS[f"2.16.840.1.101.3.4.3.{_n}"] = ("slh-dsa", None)
251
+ OIDS.update({
252
+ "1.2.840.113549.1.9.16.3.17": ("lms", "HSS/LMS"), # id-alg-hss-lms-hashsig (RFC 8708)
253
+ "1.3.6.1.5.5.7.6.34": ("lms", "XMSS"), # id-alg-xmss-hashsig (RFC 9802)
254
+ "1.3.6.1.5.5.7.6.35": ("lms", "XMSS^MT"),
255
+ "1.2.840.113549.1.1.2": ("rsa-sig", "MD2"),
256
+ "1.2.840.113549.1.1.3": ("rsa-sig", "MD4"),
257
+ "1.2.840.113549.1.1.14": ("rsa-sig", "SHA-224"),
258
+ "1.2.840.10040.4.3": ("dsa", "SHA-1"),
259
+ "2.16.840.1.101.3.4.3.2": ("dsa", "SHA-256"),
260
+ })
261
+ # Composite ML-DSA (draft-ietf-lamps-pq-composite-sigs) and the older entrust arcs.
262
+ for _n in range(37, 55):
263
+ OIDS[f"1.3.6.1.5.5.7.6.{_n}"] = ("hybrid-sig", None)
264
+
265
+ # Password-based encryption seen in PKCS#8 and PKCS#12 files -> (algorithm, note)
266
+ PBE_OIDS: dict[str, tuple[str, str]] = {
267
+ "1.2.840.113549.1.12.1.1": ("rc4", "pbeWithSHAAnd128BitRC4"),
268
+ "1.2.840.113549.1.12.1.2": ("rc4", "pbeWithSHAAnd40BitRC4"),
269
+ "1.2.840.113549.1.12.1.3": ("3des", "pbeWithSHAAnd3-KeyTripleDES-CBC"),
270
+ "1.2.840.113549.1.12.1.4": ("3des", "pbeWithSHAAnd2-KeyTripleDES-CBC"),
271
+ "1.2.840.113549.1.12.1.5": ("rc2", "pbeWithSHAAnd128BitRC2-CBC"),
272
+ "1.2.840.113549.1.12.1.6": ("rc2", "pbeWithSHAAnd40BitRC2-CBC"),
273
+ "1.2.840.113549.1.5.3": ("des", "pbeWithMD5AndDES-CBC"),
274
+ "1.2.840.113549.1.5.10": ("des", "pbeWithSHA1AndDES-CBC"),
275
+ "1.2.840.113549.1.5.13": ("pbkdf2", "PBES2"),
276
+ }
277
+ # Ciphers inside PBES2
278
+ CIPHER_OIDS: dict[str, str] = {
279
+ "2.16.840.1.101.3.4.1.2": "aes-128", "2.16.840.1.101.3.4.1.22": "aes-192",
280
+ "2.16.840.1.101.3.4.1.42": "aes-256", "1.2.840.113549.3.7": "3des", "1.3.14.3.2.7": "des",
281
+ }
212
282
 
213
283
  CURVE_OIDS = {
214
284
  "1.2.840.10045.3.1.7": "P-256",
@@ -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) -> dict:
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",
@@ -154,8 +168,8 @@ def build(findings: list[Finding], sbom: dict | None, target_name: str, crypto_l
154
168
 
155
169
  # 4. keys and certificates as their own assets
156
170
  inv = inventory.build(findings)
157
- for k in inv["keys"]:
158
- ref = _ref("key", f"{k['file']}:{k['line']}:{k['type']}")
171
+ for i, k in enumerate(inv["keys"]):
172
+ ref = _ref("key", f"{k['file']}:{k['line']}:{k['type']}:{i}")
159
173
  prop = {"type": k["type"], "algorithmRef": alg_ref_by_name[k["algorithm"]]}
160
174
  if k["size"]:
161
175
  prop["size"] = k["size"]
@@ -170,7 +184,7 @@ def build(findings: list[Finding], sbom: dict | None, target_name: str, crypto_l
170
184
  })
171
185
  crypto_refs.append(ref)
172
186
  for c in inv["certificates"]:
173
- ref = _ref("certificate", f"{c['file']}:{c['line']}")
187
+ ref = _ref("certificate", f"{c['file']}:{c['line']}:{c.get('subject')}:{c.get('not_after')}")
174
188
  cp = {"certificateFormat": "X.509"}
175
189
  for src, dst in (("subject", "subjectName"), ("issuer", "issuerName"),
176
190
  ("not_before", "notValidBefore"), ("not_after", "notValidAfter")):
@@ -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:
@@ -6,11 +6,13 @@ import argparse
6
6
  import json
7
7
  import os
8
8
  import sys
9
+ import tarfile
10
+ import tempfile
9
11
  from datetime import UTC, datetime
10
12
  from pathlib import Path
11
13
 
12
- from . import __version__, algorithms, cbom, inventory, report, rules, sbom, scanner
13
- from .detect import deps
14
+ from . import __version__, algorithms, cbom, image, inventory, report, rules, sbom, scanner
15
+ from .detect import ai, deps, vendors
14
16
  from .rules import SEVERITIES
15
17
 
16
18
 
@@ -20,7 +22,9 @@ def _parser() -> argparse.ArgumentParser:
20
22
  sub = p.add_subparsers(dest="cmd", required=True)
21
23
 
22
24
  s = sub.add_parser("scan", help="scan a folder and write a CBOM plus a readable report")
23
- s.add_argument("path", nargs="?", default=".", help="folder (or file) to scan; default: current folder")
25
+ s.add_argument("path", nargs="?", default=".",
26
+ help="folder, file, container image (e.g. nginx:1.27) or `docker save` .tar; default: current folder")
27
+ s.add_argument("--image", action="store_true", help="treat PATH as a container image reference")
24
28
  s.add_argument("-r", "--rules", default="baseline", help="rule pack(s), comma-separated, e.g. india (default: baseline)")
25
29
  s.add_argument("--rules-dir", action="append", default=[], help="extra folder of .toml rule packs")
26
30
  s.add_argument("-o", "--out", default="cbomly-out", help="output folder (default: ./cbomly-out)")
@@ -55,28 +59,63 @@ def _parser() -> argparse.ArgumentParser:
55
59
  im.add_argument("-q", "--quiet", action="store_true")
56
60
  im.add_argument("--no-color", action="store_true")
57
61
 
62
+ t = sub.add_parser("tls", help="check live TLS servers you run: versions, post-quantum key exchange, certificates")
63
+ t.add_argument("hosts", nargs="+", help="host or host:port (default port 443)")
64
+ t.add_argument("-r", "--rules", default="baseline", help="rule pack(s), comma-separated (default: baseline)")
65
+ t.add_argument("--rules-dir", action="append", default=[], help="extra folder of .toml rule packs")
66
+ t.add_argument("-o", "--out", default="cbomly-out", help="output folder (default: ./cbomly-out)")
67
+ t.add_argument("--name", help="product name to put in the reports (default: the first host)")
68
+ t.add_argument("--timeout", type=float, default=8.0, help="seconds per connection (default: 8)")
69
+ t.add_argument("--fail-on", choices=SEVERITIES[:-1], help="exit with code 1 if any issue is this severe or worse")
70
+ t.add_argument("-q", "--quiet", action="store_true")
71
+ t.add_argument("--no-color", action="store_true")
72
+
58
73
  sub.add_parser("doctor", help="check that helper tools are installed")
59
74
  return p
60
75
 
61
76
 
62
77
  def cmd_scan(a) -> int:
78
+ if a.image or image.looks_like_image(a.path) or image.is_image_archive(Path(a.path)):
79
+ return _scan_image(a)
63
80
  target = Path(a.path)
64
81
  if not target.exists():
65
82
  print(f"cbomly: {a.path}: no such file or folder", file=sys.stderr)
66
83
  return 2
67
- name = a.name or target.resolve().name
84
+ return _scan_folder(a, target, a.name or target.resolve().name)
85
+
86
+
87
+ def _scan_image(a) -> int:
88
+ log = (lambda *m: None) if a.quiet else (lambda *m: print(*m, file=sys.stderr))
89
+ with tempfile.TemporaryDirectory(prefix="cbomly-image-") as td:
90
+ root = Path(td)
91
+ log(f"Unpacking container image {a.path}…")
92
+ try:
93
+ info = image.unpack(a.path, root, log)
94
+ except (image.ImageError, OSError, KeyError, ValueError, tarfile.TarError) as e:
95
+ print(f"cbomly: could not read image {a.path}: {e}", file=sys.stderr)
96
+ return 2
97
+ notes = list(info.get("notes", []))
98
+ n_ca = image.trust_store_count(root)
99
+ if n_ca:
100
+ notes.append(f"The image's system trust store holds {n_ca} CA certificates; they are not listed as the product's own.")
101
+ name = a.name or info.get("image") or a.path
102
+ return _scan_folder(a, root, name, extra_excludes=image.TRUST_STORE_NAMES + image.SKIP_DIRS, notes=notes)
103
+
104
+
105
+ def _scan_folder(a, target: Path, name: str, extra_excludes: list[str] | None = None,
106
+ notes: list[str] | None = None) -> int:
68
107
  try:
69
108
  packs = rules.resolve([x.strip() for x in a.rules.split(",") if x.strip()], a.rules_dir)
70
109
  except ValueError as e:
71
110
  print(f"cbomly: {e}", file=sys.stderr)
72
111
  return 2
73
112
  log = (lambda *m: None) if a.quiet else (lambda *m: print(*m, file=sys.stderr))
74
- notes: list[str] = []
113
+ notes = notes or []
75
114
 
76
115
  base = [".git", ".hg", ".svn", "cbomly-out"] if a.include_vendored else list(scanner.DEFAULT_EXCLUDES)
77
- excludes = base + a.exclude + [Path(a.out).name]
116
+ excludes = base + a.exclude + [Path(a.out).name] + (extra_excludes or [])
78
117
 
79
- log(f"Scanning {target} for cryptography…")
118
+ log(f"Scanning {target} for cryptography, AI and third-party services…")
80
119
  findings, stats = scanner.scan_path(target, excludes)
81
120
  log(f" {stats.files_scanned} files read, {len(findings)} crypto uses found")
82
121
 
@@ -97,30 +136,62 @@ def cmd_scan(a) -> int:
97
136
  except sbom.SyftError as e:
98
137
  log(f" Syft failed: {e}")
99
138
  notes.append(f"Syft failed, so no software list (SBOM) was produced: {str(e)[:200]}")
139
+ if sb is not None and stats.binary_libs:
140
+ _add_binary_libs(sb, stats.binary_libs)
141
+ elif stats.binary_libs:
142
+ found = ", ".join(sorted({f"{x['library']} {x['version']}".strip() for x in stats.binary_libs}))
143
+ notes.append(f"Crypto libraries compiled into binaries: {found}.")
100
144
 
101
145
  return write_outputs(a, name, packs, findings, sb, stats, notes, tool_versions)
102
146
 
103
147
 
148
+ _LIB_PURL = {"OpenSSL": "openssl", "LibreSSL": "libressl", "BoringSSL": "boringssl", "AWS-LC": "aws-lc",
149
+ "wolfSSL": "wolfssl", "Mbed TLS": "mbedtls", "GnuTLS": "gnutls", "libgcrypt": "libgcrypt",
150
+ "OpenSSH": "openssh", "libsodium": "libsodium", "liboqs": "liboqs"}
151
+
152
+
153
+ def _add_binary_libs(sb: dict, libs: list[dict]) -> None:
154
+ """Crypto libraries found inside binaries become SBOM components (unless Syft already listed them)."""
155
+ have = {(c.get("name", "").lower(), c.get("version")) for c in sb.get("components", [])}
156
+ for lib in libs:
157
+ pname = _LIB_PURL.get(lib["library"])
158
+ if not pname or not lib["version"] or (pname, lib["version"]) in have:
159
+ continue
160
+ have.add((pname, lib["version"]))
161
+ sb.setdefault("components", []).append({
162
+ "type": "library", "name": pname, "version": lib["version"],
163
+ "bom-ref": f"cbomly-binary:{pname}@{lib['version']}",
164
+ "purl": f"pkg:generic/{pname}@{lib['version']}",
165
+ "evidence": {"occurrences": [{"location": lib["file"]}]},
166
+ })
167
+
168
+
104
169
  def write_outputs(a, name, packs, findings, sb, stats, notes, tool_versions, source=None) -> int:
105
170
  """Shared by `scan` and `import`: evaluate rules, write the three output files, print the summary."""
106
171
  libs = deps.crypto_libraries(sb)
107
172
  ev = rules.evaluate(packs, findings, sb)
108
- bom = cbom.build(findings, sb, name, libs, tool_versions, stats.services)
173
+ ai_inv = ai.inventory(stats.ai_models, stats.ai_libs + ai.libs_from_sbom(sb))
174
+ hub = [{"vendor": "Hugging Face", "service": "Hugging Face Hub and Inference", "category": "ai", "source": "code",
175
+ "file": m["file"], "line": m["line"]} for m in stats.ai_models if m["kind"] == "huggingface"]
176
+ vendor_inv = vendors.inventory(stats.vendors + hub + vendors.from_sbom(sb), stats.services)
177
+ bom = cbom.build(findings, sb, name, libs, tool_versions, stats.services, ai_inv, vendor_inv)
109
178
  n_sw = len(sb.get("components", [])) if sb else None
110
179
 
111
180
  out = Path(a.out)
112
181
  out.mkdir(parents=True, exist_ok=True)
113
182
  (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)
183
+ summary = report.markdown(name, findings, ev, libs, n_sw, notes, stats.services, ai_inv, vendor_inv)
115
184
  (out / "summary.md").write_text(summary, encoding="utf-8")
116
185
  doc = results_doc(name, findings, ev, libs, n_sw, stats)
186
+ doc["ai"] = ai_inv
187
+ doc["third_party_services"] = vendor_inv
117
188
  doc["source"] = source or {"type": "scan"}
118
189
  (out / "findings.json").write_text(json.dumps(doc, indent=2) + "\n", encoding="utf-8")
119
190
 
120
191
  if not a.quiet:
121
192
  color = sys.stdout.isatty() and not a.no_color and not os.environ.get("NO_COLOR")
122
193
  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))
194
+ print(report.terminal(findings, ev, str(out), color, title, ai_inv, vendor_inv))
124
195
 
125
196
  if a.fail_on:
126
197
  worst = ev.worst_severity()
@@ -129,6 +200,25 @@ def write_outputs(a, name, packs, findings, sb, stats, notes, tool_versions, sou
129
200
  return 0
130
201
 
131
202
 
203
+ def cmd_tls(a) -> int:
204
+ from . import tlscheck
205
+
206
+ try:
207
+ packs = rules.resolve([x.strip() for x in a.rules.split(",") if x.strip()], a.rules_dir)
208
+ except ValueError as e:
209
+ print(f"cbomly: {e}", file=sys.stderr)
210
+ return 2
211
+ log = (lambda *m: None) if a.quiet else (lambda *m: print(*m, file=sys.stderr))
212
+ findings, notes = [], ["Live TLS check: only test servers you run or are allowed to test."]
213
+ for host in a.hosts:
214
+ fs, ns = tlscheck.check(host, a.timeout, log)
215
+ findings.extend(fs)
216
+ notes.extend(ns)
217
+ stats = scanner.ScanStats()
218
+ source = {"type": "tls", "hosts": a.hosts}
219
+ return write_outputs(a, a.name or a.hosts[0], packs, findings, None, stats, notes, {}, source)
220
+
221
+
132
222
  def cmd_import(a) -> int:
133
223
  from . import importer
134
224
 
@@ -237,7 +327,7 @@ def main(argv: list[str] | None = None) -> int:
237
327
  if hasattr(stream, "reconfigure"):
238
328
  stream.reconfigure(errors="replace")
239
329
  a = _parser().parse_args(argv)
240
- return {"scan": cmd_scan, "import": cmd_import, "rules": cmd_rules, "doctor": cmd_doctor,
330
+ return {"scan": cmd_scan, "import": cmd_import, "tls": cmd_tls, "rules": cmd_rules, "doctor": cmd_doctor,
241
331
  "upload": cmd_upload}[a.cmd](a)
242
332
 
243
333