sbomly 0.1.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.
- sbomly-0.1.0/LICENSE +201 -0
- sbomly-0.1.0/PKG-INFO +203 -0
- sbomly-0.1.0/README.md +174 -0
- sbomly-0.1.0/pyproject.toml +57 -0
- sbomly-0.1.0/sbomly/__init__.py +9 -0
- sbomly-0.1.0/sbomly/__main__.py +3 -0
- sbomly-0.1.0/sbomly/assets/jetbrains-mono-LICENSE.txt +93 -0
- sbomly-0.1.0/sbomly/assets/jetbrains-mono-var.woff2 +0 -0
- sbomly-0.1.0/sbomly/assets/report.html +515 -0
- sbomly-0.1.0/sbomly/assets/space-grotesk-LICENSE.txt +93 -0
- sbomly-0.1.0/sbomly/assets/space-grotesk-var.woff2 +0 -0
- sbomly-0.1.0/sbomly/cli.py +278 -0
- sbomly-0.1.0/sbomly/diff.py +240 -0
- sbomly-0.1.0/sbomly/html.py +212 -0
- sbomly-0.1.0/sbomly/licenses.py +125 -0
- sbomly-0.1.0/sbomly/model.py +121 -0
- sbomly-0.1.0/sbomly/parse.py +295 -0
- sbomly-0.1.0/sbomly/py.typed +0 -0
- sbomly-0.1.0/sbomly/render.py +303 -0
- sbomly-0.1.0/sbomly/udiff.py +180 -0
- sbomly-0.1.0/sbomly.egg-info/PKG-INFO +203 -0
- sbomly-0.1.0/sbomly.egg-info/SOURCES.txt +29 -0
- sbomly-0.1.0/sbomly.egg-info/dependency_links.txt +1 -0
- sbomly-0.1.0/sbomly.egg-info/entry_points.txt +2 -0
- sbomly-0.1.0/sbomly.egg-info/requires.txt +3 -0
- sbomly-0.1.0/sbomly.egg-info/top_level.txt +1 -0
- sbomly-0.1.0/setup.cfg +4 -0
- sbomly-0.1.0/tests/test_diff.py +168 -0
- sbomly-0.1.0/tests/test_output.py +228 -0
- sbomly-0.1.0/tests/test_parse.py +117 -0
- sbomly-0.1.0/tests/test_udiff.py +180 -0
sbomly-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
sbomly-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sbomly
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Diff two SBOMs (CycloneDX or SPDX) into a terminal summary, PR comment, JSON or offline HTML report, and gate CI on what changed
|
|
5
|
+
Author-email: Colin Moynes <dev@fullstackspectrum.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/fullstackspectrum/sbomly
|
|
8
|
+
Project-URL: Issues, https://github.com/fullstackspectrum/sbomly/issues
|
|
9
|
+
Keywords: sbom,cyclonedx,spdx,diff,supply-chain,security,license,ci
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
[](https://github.com/fullstackspectrum/sbomly)
|
|
31
|
+
|
|
32
|
+
[](https://github.com/fullstackspectrum/sbomly/actions/workflows/build.yml)
|
|
33
|
+
[](https://pypi.org/project/sbomly/)
|
|
34
|
+
[](https://pypi.org/project/sbomly/)
|
|
35
|
+
[](https://github.com/fullstackspectrum/homebrew-sbomly)
|
|
36
|
+
[](https://hub.docker.com/r/fullstackspectrum/sbomly)
|
|
37
|
+
[](https://github.com/fullstackspectrum/sbomly/blob/main/LICENSE)
|
|
38
|
+
|
|
39
|
+
# Sbomly
|
|
40
|
+
|
|
41
|
+
**See what changed between two SBOMs, and what deserves a closer look.**
|
|
42
|
+
|
|
43
|
+
Sbomly compares two SBOMs, CycloneDX or SPDX JSON, and tells you which components were added, removed, upgraded or downgraded. It also flags the changes a reviewer should actually stop for:
|
|
44
|
+
|
|
45
|
+
- **Integrity:** same version, different digest. The artifact was rebuilt or replaced.
|
|
46
|
+
- **Copyleft:** a new dependency, or a new licence, that brings in GPL, LGPL, AGPL and similar.
|
|
47
|
+
- **Licence:** a licence changed, or stopped being declared.
|
|
48
|
+
- **Supplier:** a package's supplier changed. In a language ecosystem that's the account-takeover pattern.
|
|
49
|
+
|
|
50
|
+
Output goes wherever you need it: a terminal summary, a Markdown summary sized for a PR comment, JSON for other tools, and a self-contained HTML report that works offline. `--fail-on` turns any category into a CI gate.
|
|
51
|
+
|
|
52
|
+
Sbomly has no runtime dependencies and needs Python 3.10 or later.
|
|
53
|
+
|
|
54
|
+
> Sbomly is a sibling of [Vulnly](https://github.com/fullstackspectrum/Vulnly) and part of [Full-Stack-Spectrum](https://fullstackspectrum.com/): small open-source tools that turn noisy supply chain data into decisions.
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pipx install sbomly # or: pip install sbomly
|
|
62
|
+
brew install fullstackspectrum/sbomly/sbomly
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or run the container image, mounting the directory that holds your SBOMs:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
docker run --rm -t -v "$PWD:/data" fullstackspectrum/sbomly diff old.json new.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
sbomly diff old.cdx.json new.cdx.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Findings come first, most serious at the top, then each kind of component change:
|
|
78
|
+
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+
Write reports alongside the terminal summary:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
sbomly diff old.json new.json --html report.html --markdown pr.md --json diff.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The HTML report, shown at the top of this page, is a single file with its fonts embedded, so it opens offline and can be attached to a CI run or a ticket. Search and the change-type filters work without a network connection, and `--theme light` gives a light version for printing.
|
|
88
|
+
|
|
89
|
+
### Diff view
|
|
90
|
+
|
|
91
|
+
Prefer to read changes the way you read code? `-u` prints a unified diff of the two component lists, like `diff -u`, with one line per component sorted like a lockfile:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
sbomly diff old.json new.json -u # 3 lines of context
|
|
95
|
+
sbomly diff old.json new.json -u -U 0 # changes only
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
|
|
100
|
+
In a colour terminal, the diff gets an old/new line-number gutter and highlights the words that changed in each `-`/`+` pair. When piped, or with `--no-color`, it's a plain unified diff that `patch` and other diff tools accept.
|
|
101
|
+
|
|
102
|
+
Each line shows the name, version and licence. A digest or supplier is added only where it changed, so a same-version finding still shows up as a `-`/`+` pair. Lines come from Sbomly's own comparison rather than the raw files, so anything it treats as equivalent, like licence term order or a new distro qualifier, stays as context instead of showing up as noise. The output is a valid patch.
|
|
103
|
+
|
|
104
|
+
The HTML report has the same diff behind a `table` / `diff` toggle, with line numbers and the changed words highlighted. Add `#diff` to the report's URL to open it on the diff view. With `-u`, the Markdown output also gets a ```` ```diff ```` block, which GitHub colours in PR comments.
|
|
105
|
+
|
|
106
|
+

|
|
107
|
+
|
|
108
|
+
*Screenshots show sample data from `tests/fixtures`. To regenerate them, run `python docs/screenshots/src/render.py`.*
|
|
109
|
+
|
|
110
|
+
Read one SBOM from stdin, for example straight from a generator:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
syft my-image:latest -o cyclonedx-json | sbomly diff baseline.cdx.json -
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Options
|
|
117
|
+
|
|
118
|
+
| Option | |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `-f, --format text\|markdown\|json` | What to print to stdout (default `text`) |
|
|
121
|
+
| `--html FILE` | Write the offline HTML report |
|
|
122
|
+
| `--markdown FILE` | Write the Markdown summary |
|
|
123
|
+
| `--json FILE` | Write the full diff as JSON |
|
|
124
|
+
| `--fail-on LIST` | Exit 1 if any of these categories occur (see below) |
|
|
125
|
+
| `-u, --unified` | Print a unified diff of the component lists instead of the summary, and add it to Markdown output |
|
|
126
|
+
| `-U, --context N` | Unchanged components shown around each change in the diff (default 3) |
|
|
127
|
+
| `--title TEXT` | Title for the HTML and Markdown reports |
|
|
128
|
+
| `--theme dark\|light` | HTML report theme (default `dark`) |
|
|
129
|
+
| `--limit N` | Rows per section in text and Markdown (default 100) |
|
|
130
|
+
| `--no-color` | Plain terminal output. `NO_COLOR` and `FORCE_COLOR` are respected |
|
|
131
|
+
| `-q, --quiet` | Print nothing to stdout |
|
|
132
|
+
|
|
133
|
+
### Gating CI with `--fail-on`
|
|
134
|
+
|
|
135
|
+
| Category | Fails when |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `added` / `removed` | A component appears or disappears |
|
|
138
|
+
| `upgraded` / `downgraded` | A component moves to a newer or older version |
|
|
139
|
+
| `changed` | A version changes but can't be ordered (commit SHAs, digests) |
|
|
140
|
+
| `hash` | Same version, different digest |
|
|
141
|
+
| `copyleft` | A new dependency is copyleft, or a licence becomes more restrictive |
|
|
142
|
+
| `license` | A licence changes, or is no longer declared |
|
|
143
|
+
| `supplier` | A component's supplier changes |
|
|
144
|
+
| `any` | Any of the above |
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
sbomly diff main.cdx.json pr.cdx.json --fail-on hash,copyleft,downgraded
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Exit codes: `0` passed, `1` a `--fail-on` category was hit, `2` bad usage or an unreadable SBOM.
|
|
151
|
+
|
|
152
|
+
Some findings are informational. They're shown, but they never fail a build:
|
|
153
|
+
|
|
154
|
+
- A licence that was unknown and is now declared.
|
|
155
|
+
- A same-version digest change where the purl's `distro` qualifier also changed. Distros rebuild unchanged packages for each release.
|
|
156
|
+
- A supplier change for an OS package (apk, deb, rpm). There, the supplier is the distro maintainer, and maintainers rotate.
|
|
157
|
+
|
|
158
|
+
## GitHub Actions
|
|
159
|
+
|
|
160
|
+
Sbomly ships as a composite action. It writes the Markdown summary to the job page, and exposes the report paths for a PR comment or artifact upload.
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
- uses: fullstackspectrum/sbomly@v0.1.0
|
|
164
|
+
with:
|
|
165
|
+
old: sbom-main.cdx.json
|
|
166
|
+
new: sbom-pr.cdx.json
|
|
167
|
+
fail-on: hash,copyleft
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Or call the CLI yourself on any CI system:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pipx run sbomly diff baseline.json current.json --markdown sbomly.md --fail-on hash
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## How components are matched
|
|
177
|
+
|
|
178
|
+
Components are paired across the two SBOMs by package URL, ignoring the version. Qualifiers that only describe the build environment, like `distro` and `repository_url`, are also ignored, so moving to a new base image doesn't report every OS package as removed and re-added. `arch`, `classifier` and `type` are kept, because they identify a different artifact. PyPI names are normalised as PEP 503 describes. Components without a purl fall back to their group and name.
|
|
179
|
+
|
|
180
|
+
When a package has several versions in both SBOMs, which npm often does, the leftover versions are paired in version order.
|
|
181
|
+
|
|
182
|
+
## Supported formats
|
|
183
|
+
|
|
184
|
+
| Format | Versions |
|
|
185
|
+
|---|---|
|
|
186
|
+
| CycloneDX JSON | 1.4 to 1.6 tested, older versions usually work |
|
|
187
|
+
| SPDX JSON | 2.2, 2.3 |
|
|
188
|
+
|
|
189
|
+
CycloneDX XML, SPDX tag-value and SPDX 3.0 aren't supported yet. Sbomly tells you so rather than guessing.
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
python -m venv .venv && . .venv/bin/activate
|
|
195
|
+
pip install -e ".[dev]"
|
|
196
|
+
pytest
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Licence
|
|
200
|
+
|
|
201
|
+
Apache-2.0. The bundled Space Grotesk and JetBrains Mono fonts are under the SIL Open Font License 1.1. See `sbomly/assets/`.
|
|
202
|
+
|
|
203
|
+
Copyleft classification is a triage signal, not legal advice.
|
sbomly-0.1.0/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
[](https://github.com/fullstackspectrum/sbomly)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/fullstackspectrum/sbomly/actions/workflows/build.yml)
|
|
4
|
+
[](https://pypi.org/project/sbomly/)
|
|
5
|
+
[](https://pypi.org/project/sbomly/)
|
|
6
|
+
[](https://github.com/fullstackspectrum/homebrew-sbomly)
|
|
7
|
+
[](https://hub.docker.com/r/fullstackspectrum/sbomly)
|
|
8
|
+
[](https://github.com/fullstackspectrum/sbomly/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
# Sbomly
|
|
11
|
+
|
|
12
|
+
**See what changed between two SBOMs, and what deserves a closer look.**
|
|
13
|
+
|
|
14
|
+
Sbomly compares two SBOMs, CycloneDX or SPDX JSON, and tells you which components were added, removed, upgraded or downgraded. It also flags the changes a reviewer should actually stop for:
|
|
15
|
+
|
|
16
|
+
- **Integrity:** same version, different digest. The artifact was rebuilt or replaced.
|
|
17
|
+
- **Copyleft:** a new dependency, or a new licence, that brings in GPL, LGPL, AGPL and similar.
|
|
18
|
+
- **Licence:** a licence changed, or stopped being declared.
|
|
19
|
+
- **Supplier:** a package's supplier changed. In a language ecosystem that's the account-takeover pattern.
|
|
20
|
+
|
|
21
|
+
Output goes wherever you need it: a terminal summary, a Markdown summary sized for a PR comment, JSON for other tools, and a self-contained HTML report that works offline. `--fail-on` turns any category into a CI gate.
|
|
22
|
+
|
|
23
|
+
Sbomly has no runtime dependencies and needs Python 3.10 or later.
|
|
24
|
+
|
|
25
|
+
> Sbomly is a sibling of [Vulnly](https://github.com/fullstackspectrum/Vulnly) and part of [Full-Stack-Spectrum](https://fullstackspectrum.com/): small open-source tools that turn noisy supply chain data into decisions.
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pipx install sbomly # or: pip install sbomly
|
|
33
|
+
brew install fullstackspectrum/sbomly/sbomly
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or run the container image, mounting the directory that holds your SBOMs:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
docker run --rm -t -v "$PWD:/data" fullstackspectrum/sbomly diff old.json new.json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
sbomly diff old.cdx.json new.cdx.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Findings come first, most serious at the top, then each kind of component change:
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
Write reports alongside the terminal summary:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
sbomly diff old.json new.json --html report.html --markdown pr.md --json diff.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The HTML report, shown at the top of this page, is a single file with its fonts embedded, so it opens offline and can be attached to a CI run or a ticket. Search and the change-type filters work without a network connection, and `--theme light` gives a light version for printing.
|
|
59
|
+
|
|
60
|
+
### Diff view
|
|
61
|
+
|
|
62
|
+
Prefer to read changes the way you read code? `-u` prints a unified diff of the two component lists, like `diff -u`, with one line per component sorted like a lockfile:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
sbomly diff old.json new.json -u # 3 lines of context
|
|
66
|
+
sbomly diff old.json new.json -u -U 0 # changes only
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+

|
|
70
|
+
|
|
71
|
+
In a colour terminal, the diff gets an old/new line-number gutter and highlights the words that changed in each `-`/`+` pair. When piped, or with `--no-color`, it's a plain unified diff that `patch` and other diff tools accept.
|
|
72
|
+
|
|
73
|
+
Each line shows the name, version and licence. A digest or supplier is added only where it changed, so a same-version finding still shows up as a `-`/`+` pair. Lines come from Sbomly's own comparison rather than the raw files, so anything it treats as equivalent, like licence term order or a new distro qualifier, stays as context instead of showing up as noise. The output is a valid patch.
|
|
74
|
+
|
|
75
|
+
The HTML report has the same diff behind a `table` / `diff` toggle, with line numbers and the changed words highlighted. Add `#diff` to the report's URL to open it on the diff view. With `-u`, the Markdown output also gets a ```` ```diff ```` block, which GitHub colours in PR comments.
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
*Screenshots show sample data from `tests/fixtures`. To regenerate them, run `python docs/screenshots/src/render.py`.*
|
|
80
|
+
|
|
81
|
+
Read one SBOM from stdin, for example straight from a generator:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
syft my-image:latest -o cyclonedx-json | sbomly diff baseline.cdx.json -
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Options
|
|
88
|
+
|
|
89
|
+
| Option | |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `-f, --format text\|markdown\|json` | What to print to stdout (default `text`) |
|
|
92
|
+
| `--html FILE` | Write the offline HTML report |
|
|
93
|
+
| `--markdown FILE` | Write the Markdown summary |
|
|
94
|
+
| `--json FILE` | Write the full diff as JSON |
|
|
95
|
+
| `--fail-on LIST` | Exit 1 if any of these categories occur (see below) |
|
|
96
|
+
| `-u, --unified` | Print a unified diff of the component lists instead of the summary, and add it to Markdown output |
|
|
97
|
+
| `-U, --context N` | Unchanged components shown around each change in the diff (default 3) |
|
|
98
|
+
| `--title TEXT` | Title for the HTML and Markdown reports |
|
|
99
|
+
| `--theme dark\|light` | HTML report theme (default `dark`) |
|
|
100
|
+
| `--limit N` | Rows per section in text and Markdown (default 100) |
|
|
101
|
+
| `--no-color` | Plain terminal output. `NO_COLOR` and `FORCE_COLOR` are respected |
|
|
102
|
+
| `-q, --quiet` | Print nothing to stdout |
|
|
103
|
+
|
|
104
|
+
### Gating CI with `--fail-on`
|
|
105
|
+
|
|
106
|
+
| Category | Fails when |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `added` / `removed` | A component appears or disappears |
|
|
109
|
+
| `upgraded` / `downgraded` | A component moves to a newer or older version |
|
|
110
|
+
| `changed` | A version changes but can't be ordered (commit SHAs, digests) |
|
|
111
|
+
| `hash` | Same version, different digest |
|
|
112
|
+
| `copyleft` | A new dependency is copyleft, or a licence becomes more restrictive |
|
|
113
|
+
| `license` | A licence changes, or is no longer declared |
|
|
114
|
+
| `supplier` | A component's supplier changes |
|
|
115
|
+
| `any` | Any of the above |
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
sbomly diff main.cdx.json pr.cdx.json --fail-on hash,copyleft,downgraded
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Exit codes: `0` passed, `1` a `--fail-on` category was hit, `2` bad usage or an unreadable SBOM.
|
|
122
|
+
|
|
123
|
+
Some findings are informational. They're shown, but they never fail a build:
|
|
124
|
+
|
|
125
|
+
- A licence that was unknown and is now declared.
|
|
126
|
+
- A same-version digest change where the purl's `distro` qualifier also changed. Distros rebuild unchanged packages for each release.
|
|
127
|
+
- A supplier change for an OS package (apk, deb, rpm). There, the supplier is the distro maintainer, and maintainers rotate.
|
|
128
|
+
|
|
129
|
+
## GitHub Actions
|
|
130
|
+
|
|
131
|
+
Sbomly ships as a composite action. It writes the Markdown summary to the job page, and exposes the report paths for a PR comment or artifact upload.
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
- uses: fullstackspectrum/sbomly@v0.1.0
|
|
135
|
+
with:
|
|
136
|
+
old: sbom-main.cdx.json
|
|
137
|
+
new: sbom-pr.cdx.json
|
|
138
|
+
fail-on: hash,copyleft
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Or call the CLI yourself on any CI system:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pipx run sbomly diff baseline.json current.json --markdown sbomly.md --fail-on hash
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## How components are matched
|
|
148
|
+
|
|
149
|
+
Components are paired across the two SBOMs by package URL, ignoring the version. Qualifiers that only describe the build environment, like `distro` and `repository_url`, are also ignored, so moving to a new base image doesn't report every OS package as removed and re-added. `arch`, `classifier` and `type` are kept, because they identify a different artifact. PyPI names are normalised as PEP 503 describes. Components without a purl fall back to their group and name.
|
|
150
|
+
|
|
151
|
+
When a package has several versions in both SBOMs, which npm often does, the leftover versions are paired in version order.
|
|
152
|
+
|
|
153
|
+
## Supported formats
|
|
154
|
+
|
|
155
|
+
| Format | Versions |
|
|
156
|
+
|---|---|
|
|
157
|
+
| CycloneDX JSON | 1.4 to 1.6 tested, older versions usually work |
|
|
158
|
+
| SPDX JSON | 2.2, 2.3 |
|
|
159
|
+
|
|
160
|
+
CycloneDX XML, SPDX tag-value and SPDX 3.0 aren't supported yet. Sbomly tells you so rather than guessing.
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
python -m venv .venv && . .venv/bin/activate
|
|
166
|
+
pip install -e ".[dev]"
|
|
167
|
+
pytest
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Licence
|
|
171
|
+
|
|
172
|
+
Apache-2.0. The bundled Space Grotesk and JetBrains Mono fonts are under the SIL Open Font License 1.1. See `sbomly/assets/`.
|
|
173
|
+
|
|
174
|
+
Copyleft classification is a triage signal, not legal advice.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sbomly"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Diff two SBOMs (CycloneDX or SPDX) into a terminal summary, PR comment, JSON or offline HTML report, and gate CI on what changed"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Colin Moynes", email = "dev@fullstackspectrum.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["sbom", "cyclonedx", "spdx", "diff", "supply-chain", "security", "license", "ci"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: System Administrators",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: Security",
|
|
28
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
29
|
+
"Typing :: Typed",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=7.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/fullstackspectrum/sbomly"
|
|
39
|
+
Issues = "https://github.com/fullstackspectrum/sbomly/issues"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
sbomly = "sbomly:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.dynamic]
|
|
45
|
+
# One source of truth: the release workflow checks the tag against __version__.
|
|
46
|
+
version = { attr = "sbomly.__version__" }
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
include = ["sbomly*"]
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.package-data]
|
|
52
|
+
sbomly = ["py.typed", "assets/*"]
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
# Import sbomly from the working tree so the suite runs without installing.
|
|
57
|
+
pythonpath = ["."]
|