Skip to content

Commit 3845ec0

Browse files
committed
Some dockerfile SBOMS fail validation
Problem: Validator complains about 'author' appearing before 'group' or name'. Solution: Enforce latest versions of syft, cdx cmds and check ordering guarantees with Elementtree python module. Upgrade to cyclonedx 1.4. Create Dockerfile to enforce dependency versions and enable local testing. Remove xmllinting of cyclonedx as upstream now handles this. Executing xmllint was failing to invalidate the xml file because of the need to execute in a pipeline. sbom_scraper.sh can now be executed from any location and is not tied to being executed in the repo. Signed-off-by: Paul Hewlett <phewlett76@gmail.com>
1 parent 1708d03 commit 3845ec0

5 files changed

Lines changed: 193 additions & 82 deletions

File tree

Dockerfile-scraper

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM ubuntu:jammy
2+
3+
RUN apt-get update \
4+
&& apt-get upgrade -y --no-install-recommends \
5+
&& apt-get install -y \
6+
curl \
7+
default-jdk \
8+
jq \
9+
libdigest-sha-perl \
10+
openssl \
11+
python3-pip \
12+
&& apt-get autoremove \
13+
&& apt-get autoclean \
14+
&& apt-get clean \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
RUN python3 -m pip install yq
18+
19+
RUN curl -fsSOL https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.24.2/cyclonedx-linux-x64 \
20+
&& mv cyclonedx-linux-x64 /usr/local/bin/cdx \
21+
&& chmod +x /usr/local/bin/cdx \
22+
&& curl -fsSOL https://github.com/anchore/syft/releases/download/v0.60.3/syft_0.60.3_linux_amd64.tar.gz \
23+
&& tar xvzf syft_0.60.3_linux_amd64.tar.gz syft \
24+
&& mv syft /usr/local/bin \
25+
&& chmod +x /usr/local/bin/syft \
26+
&& rm syft_0.60.3_linux_amd64.tar.gz
27+
28+
RUN which cdx \
29+
&& which curl \
30+
&& which jar \
31+
&& which jdeps \
32+
&& which jq \
33+
&& which openssl \
34+
&& which python3 \
35+
&& which shasum \
36+
&& which syft \
37+
&& which xq
38+
39+
COPY scripts/sbom_scraper.sh /usr/local/bin/sbom_scraper.sh
40+
RUN chmod +x /usr/local/bin/sbom_scraper.sh
41+
42+
ENTRYPOINT ["/usr/local/bin/sbom_scraper.sh"]

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ Make a change to the code and validate the changes:
8787
task check
8888
```
8989

90+
And then test changes with a working set of options:
91+
92+
```bash
93+
task build-scraper
94+
task scrape -- -h
95+
task scrape -- -a "RKVST, Inc" \
96+
-e support@rkvst.com \
97+
-A Docker \
98+
-c credentials/client_secret \
99+
-u https://app.rkvst.io \
100+
8f8f2467-01fe-48fb-891a-5c0be643cec1 \
101+
aerospike:ce-6.0.0.5
102+
```
103+
90104
### Seeking a review
91105

92106
#### Synchronizing the upstream

Taskfile.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ version: '3'
22

33
tasks:
44

5+
build-scraper:
6+
desc: Build scraper image
7+
cmds:
8+
- docker build --no-cache -f Dockerfile-scraper -t archivist-shell-scraper .
9+
510
check:
611
desc: Standard linting of shell scripts
712
cmds:
@@ -11,3 +16,17 @@ tasks:
1116
desc: Clean git repo
1217
cmds:
1318
- git clean -fdX
19+
20+
scrape:
21+
desc: Execute scraper command in dockerfile
22+
cmds:
23+
- |
24+
docker run \
25+
--rm -it \
26+
-v $(pwd):$(pwd) \
27+
-w $(pwd) \
28+
-u $(id -u):$(id -g) \
29+
-e USER \
30+
archivist-shell-scraper \
31+
{{.CLI_ARGS}}
32+

scripts/cyclonedx-wrapper.xsd

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)