Skip to content

Commit b973a04

Browse files
Merge branch 'main' into update/deps-2
2 parents 4ce3407 + 70ec764 commit b973a04

File tree

10 files changed

+240
-69
lines changed

10 files changed

+240
-69
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: docker/build-push-action@v2
3939
with:
4040
context: .
41-
platforms: linux/amd64
41+
platforms: linux/amd64, linux/arm64
4242
push: true
4343
tags: ${{ steps.meta.outputs.tags }}
44-
labels: ${{ steps.meta.outputs.labels }}
44+
labels: ${{ steps.meta.outputs.labels }}

.goreleaser.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,26 @@ builds:
3131
env:
3232
- CGO_ENABLED=0
3333

34+
nfpms:
35+
- id: sbomgr
36+
package_name: sbomgr
37+
file_name_template: "{{ .ConventionalFileName }}"
38+
vendor: Interlynk
39+
homepage: https://interlynk.io
40+
maintainer: Interlynk Authors [email protected]
41+
builds:
42+
- binaries
43+
description: SBOM Grep - search through SBOMs
44+
license: "Apache License 2.0"
45+
formats:
46+
- apk
47+
- deb
48+
- rpm
49+
contents:
50+
- src: /usr/bin/sbomgr-{{ .Os }}-{{ .Arch }}
51+
dst: /usr/bin/sbomgr
52+
type: "symlink"
53+
3454
archives:
3555
- format: binary
3656
name_template: "{{ .Binary }}"

Dockerfile

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM golang:1.22.2-alpine AS builder
1+
# Use buildx for multi-platform builds
2+
# Build stage
3+
FROM --platform=$BUILDPLATFORM golang:1.22.2-alpine AS builder
24
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomgr"
35

46
RUN apk add --no-cache make git
@@ -7,19 +9,16 @@ COPY go.mod go.sum ./
79
RUN go mod download
810
COPY . .
911

10-
RUN make ; make build
12+
# Build for multiple architectures
13+
ARG TARGETOS TARGETARCH
14+
RUN make build && chmod +x ./build/sbomgr
1115

12-
FROM scratch
16+
# Final stage
17+
FROM alpine:3.19
1318
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomgr"
1419
LABEL org.opencontainers.image.description="Search through SBOMs"
1520
LABEL org.opencontainers.image.licenses=Apache-2.0
1621

17-
COPY --from=builder /bin/sh /bin/grep /bin/busybox /bin/touch /bin/chmod /bin/mkdir /bin/date /bin/cat /bin/
18-
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
19-
COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
20-
COPY --from=builder /tmp /tmp
21-
COPY --from=builder /usr/bin /usr/bin
22-
2322
# Copy our static executable
2423
COPY --from=builder /app/build/sbomgr /app/sbomgr
2524

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ test: generate
6161

6262
.PHONY: build
6363
build:
64-
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/sbomgr main.go
64+
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/sbomgr main.go
6565

6666
.PHONY: clean
6767
clean:

README.md

+73-28
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,74 @@
2626
```sh
2727
go install github.com/interlynk-io/sbomgr@latest
2828
```
29+
2930
other installations [options](#installation)
3031

32+
# SBOM Platform - Free Tier
33+
34+
Our SBOM Automation Platform has a new free tier that provides a comprehensive solution to manage SBOMs (Software Bill of Materials) effortlessly. From centralized SBOM storage, built-in SBOM editor, continuous vulnerability mapping and assessment, and support for organizational policies, all while ensuring compliance and enhancing software supply chain security using integrated SBOM quality scores. The free tier is ideal for small teams. [Sign up](https://app.interlynk.io/)
35+
3136
# SBOM Card
32-
[![SBOMCard](https://api.interlynk.io/api/v1/badges?type=hcard&project_group_id=e8e2ba0c-3d04-4a2e-9b37-dca774bd08bd
33-
)](https://app.interlynk.io/customer/products?id=e8e2ba0c-3d04-4a2e-9b37-dca774bd08bd&signed_url_params=eyJfcmFpbHMiOnsibWVzc2FnZSI6IklqSmtaakkyTkRRMUxXSTBaR0V0TkdJME9TMWhPVFpqTFRBd09UZGtZMlptTWpabU9TST0iLCJleHAiOm51bGwsInB1ciI6InNoYXJlX2x5bmsvc2hhcmVfbHluayJ9fQ==--6d74d14e40d6676522b1c529d44e4a320f05bcf3d42121e61e1275a1297a3453)
37+
38+
[![SBOMCard](https://api.interlynk.io/api/v1/badges?type=hcard&project_group_id=e8e2ba0c-3d04-4a2e-9b37-dca774bd08bd)](https://app.interlynk.io/customer/products?id=e8e2ba0c-3d04-4a2e-9b37-dca774bd08bd&signed_url_params=eyJfcmFpbHMiOnsibWVzc2FnZSI6IklqSmtaakkyTkRRMUxXSTBaR0V0TkdJME9TMWhPVFpqTFRBd09UZGtZMlptTWpabU9TST0iLCJleHAiOm51bGwsInB1ciI6InNoYXJlX2x5bmsvc2hhcmVfbHluayJ9fQ==--6d74d14e40d6676522b1c529d44e4a320f05bcf3d42121e61e1275a1297a3453)
3439

3540
# Basic usage
41+
3642
Search for packages with exact name matching "abbrev".
43+
3744
```sh
3845
sbomgr packages -N 'abbrev' <sbom file or dir>
3946
```
4047

4148
Search for packages with regexp name matching "log4"
49+
4250
```sh
4351
sbomgr packages -EN 'log4' <sbom file or dir>
4452
```
4553

4654
Search for packages in air gapped environment for name matching "log4"
55+
4756
```sh
4857
export INTERLYNK_DISABLE_VERSION_CHECK=true sbomgr packages -EN 'log4' <sbom file or dir>
4958
```
59+
5060
# Features
61+
5162
- SBOM format agnostic and currently supports searching through SPDX and CycloneDX.
5263
- Blazing Fast :rocket:
5364
- Output search results as [jsonl](https://jsonlines.org/).
5465
- Supports RE2 [regular expressions](https://github.com/google/re2/wiki/Syntax)
5566

56-
5767
# Use cases
68+
5869
`sbomgr` can answer some of the most common SBOM use cases by searching an SBOM file or SBOM repository.
5970

6071
#### How many SBOM and packages exist in the repository?
72+
6173
```sh
6274
➜ sbomgr packages -c ~/data/sbom-repo/docker-images
6375
sbom_files_matched: 86
6476
packages_matched: 33556
6577
```
78+
6679
#### Are there packages with `zlib` in the name?
80+
6781
```sh
6882
➜ sbomgr packages -cEN 'zlib' ~/data/sbom-repo/docker-images
6983
sbom_files_matched: 71
7084
packages_matched: 145
7185
```
86+
7287
#### Are there packages with a given checksum?
88+
7389
```sh
7490
➜ sbomgr packages -c -H '5c260231de4f62ee26888776190b4c3fda6cbe14' ~/data/sbom-repo/docker-images
7591
sbom_files_matched: 2
7692
packages_matched: 2
7793
```
7894

7995
#### Create a json report of packages with .zip files
96+
8097
```sh
8198
➜ sbomgr packages -jrE -N '\.zip$' ~/data/ | jq .
8299
{
@@ -96,6 +113,7 @@ packages_matched: 2
96113
```
97114

98115
#### Create a json report of all licenses included in an sbom
116+
99117
```sh
100118
➜ sbomgr packages -jl ~/data/some-sboms/julia.spdx | jq .
101119
{
@@ -116,8 +134,8 @@ packages_matched: 2
116134
},
117135
```
118136
119-
120137
#### During CI check if a malicious package is present??
138+
121139
```sh
122140
➜ sbomgr packages -qN 'abbrev' ~/tmp/app.spdx.json
123141
echo $?
@@ -128,21 +146,26 @@ packages_matched: 2
128146
```
129147
130148
#### extract data using user-defined output
149+
131150
```sh
132151
sbomgr packages -O 'toolv,tooln,pkgn,pkgv' ~/tmp/app.spdx.json
133152
2.0.88 Microsoft.SBOMTool Coordinated Packages 229170
134153
2.0.88 Microsoft.SBOMTool chalk 2.4.2
135154
2.0.88 Microsoft.SBOMTool async-settle 1.0.0
136155
```
156+
137157
#### Using containerized sbomgr
138158
139159
```sh
140160
$docker run [volume-maps] ghcr.io/interlynk-io/sbomgr [command] [options]
141161
```
162+
142163
Example
164+
143165
```sh
144166
$docker run -v ~/interlynk/sbomlc/:/app/sbomlc ghcr.io/interlynk-io/sbomgr packages -c /app/sbomlc
145167
```
168+
146169
```
147170
Unable to find image 'ghcr.io/interlynk-io/sbomgr:latest' locally
148171
latest: Pulling from interlynk-io/sbomgr
@@ -160,28 +183,37 @@ Matching package count: 716953
160183
# Search flags
161184
162185
## Packages
186+
163187
This section explains the flags relevant to the packages search feature.
164188
The packages search takes only a single argument, either a file or a directory. There are man flags which can be specified to control its behaviour.
165189
166-
#### *Match Criteria*
190+
#### _Match Criteria_
191+
167192
---
193+
168194
- `-N` or `--name` used for package/component name search.
169195
- `-C` or `--cpe` used for package/component cpe search.
170196
- `-P` or `--purl` used for pacakge/component purl search.
171197
- `-H` or `--checksum` used for package/component checksum value search.
172198
173199
all of these match criteria are exclusive to each other.
174200
175-
#### *Patter Matching*
176-
---------
201+
#### _Patter Matching_
202+
203+
---
204+
177205
- `-E` or `--extended-regexp` flag can be used to indicate if the match criteria is a regular expression. Syntax supported is https://github.com/google/re2/wiki/Syntax.
178206
179-
#### *Matching Control*
180-
-----
207+
#### _Matching Control_
208+
209+
---
210+
181211
- `-i` or `--ignore-case` case insensitive matching.
182212
183-
#### *Output Control*
184-
----
213+
#### _Output Control_
214+
215+
---
216+
185217
- `-l` or `--license` this includes the license of the package/component in the output.
186218
- `-q` or `--quiet` this suppresses all output of the tool, the return value of the tool is 0 indicating success, if it finds the search criteria.
187219
- `--no-filename` removes the filename from the output.
@@ -191,32 +223,40 @@ all of these match criteria are exclusive to each other.
191223
- `filen` - filepath
192224
- `tooln` - tool with which sbom was generated, only prints the first one
193225
- `toolv` - tool version
194-
- `docn` - sbom document name
195-
- `docv` - sbom document version
196-
- `cpe` - package cpe, only prints the first one, indicates how many cpe's exists.
197-
- `purl` - package purl
198-
- `pkgn` - package name
199-
- `pkgv` - package version
200-
- `pkgl` - package licenses
226+
- `docn` - sbom document name
227+
- `docv` - sbom document version
228+
- `cpe` - package cpe, only prints the first one, indicates how many cpe's exists.
229+
- `purl` - package purl
230+
- `pkgn` - package name
231+
- `pkgv` - package version
232+
- `pkgl` - package licenses
201233
- `specn` - spec of the sbom document, spdx or cdx.
202-
- `chkn` - checksum name
203-
- `chkv` - checksum value
204-
- `repo` - repository url
234+
- `chkn` - checksum name
235+
- `chkv` - checksum value
236+
- `repo` - repository url
237+
- `direct` - package is a direct dependency
238+
239+
#### _Stats Control_
240+
241+
---
205242
206-
#### *Stats Control*
207-
----
208243
- `-c` or `--count` suppresses the normal output and print matching counts of sbom filenames and packages.
209244
210-
#### *Directory Control*
211-
----
245+
#### _Directory Control_
246+
247+
---
248+
212249
- `-r` or `--recurse` when set, recursively scans all sub directories.
213250
214-
#### *Spec Control*
215-
----
251+
#### _Spec Control_
252+
253+
---
254+
216255
- `--spdx` searches only files which are SPDX.
217256
- `--cdx` searches only files which are CycloneDX.
218257
219258
# Future work
259+
220260
- Search using files.
221261
- Search using tool metadata.
222262
- Search using CVE-ID.
@@ -225,6 +265,7 @@ all of these match criteria are exclusive to each other.
225265
- Provide a list of malicious packages
226266
227267
# SBOM Samples
268+
228269
- A sample set of SBOM is present in the [samples](https://github.com/interlynk-io/sbomgr/tree/main/samples) directory above.
229270
- [SBOM Benchmark](https://www.sbombenchmark.dev) is a repository of SBOM and quality score for most popular containers and repositories
230271
- [SBOM Explorer](https://github.com/interlynk-io/sbomex) is a command line utility to search and pull SBOMs
@@ -238,6 +279,7 @@ https://github.com/interlynk-io/sbomgr/releases
238279
```
239280
240281
## Using Homebrew
282+
241283
```console
242284
brew tap interlynk-io/interlynk
243285
brew install sbomgr
@@ -258,8 +300,8 @@ This approach involves cloning the repo and building it.
258300
3. make build
259301
4. To test if the build was successful run the following command `./build/sbomgr version`
260302
261-
262303
# Contributions
304+
263305
We look forward to your contributions, below are a few guidelines on how to submit them
264306
265307
- Fork the repo
@@ -269,13 +311,16 @@ We look forward to your contributions, below are a few guidelines on how to subm
269311
- Create a new pull-request
270312
271313
# Other SBOM Open Source tools
314+
272315
- [SBOM Assembler](https://github.com/interlynk-io/sbomasm) - A tool to compose a single SBOM by combining other (part) SBOMs
273316
- [SBOM Quality Score](https://github.com/interlynk-io/sbomqs) - A tool for evaluating the quality and completeness of SBOMs
274317
- [SBOM Search Tool](https://github.com/interlynk-io/sbomagr) - A tool to grep style semantic search in SBOMs
275318
- [SBOM Explorer](https://github.com/interlynk-io/sbomex) - A tool for discovering and downloading SBOM from a public repository
276319
277320
# Contact
321+
278322
We appreciate all feedback. The best ways to get in touch with us:
323+
279324
- :phone: [Live Chat](https://www.interlynk.io/#hs-chat-open)
280325
- 📫 [Email Us](mailto:[email protected])
281326
- 🐛 [Report a bug or enhancement](https://github.com/interlynk-io/sbomex/issues)

0 commit comments

Comments
 (0)