Skip to content

Commit 4b6fa07

Browse files
committed
chore: improve SLSA verifier installation
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
1 parent b995a10 commit 4b6fa07

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
- gen-build-spec SQL query to look up build-as-code check build command joins on incorrect column (#1207)
2929
- handle all tarfile extract errors (#1206)
30-
- ensure Python 3.11.14 is used to address GHSA-4xh5-x5gv-qwph (#1197)
30+
- ensure Python 3.11.13 is used to address GHSA-4xh5-x5gv-qwph (#1197)
3131
- **docs**: path of script download example (#1193)
3232
- improve build tool detection (#1169)
3333

Makefile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,27 @@ setup: force-upgrade setup-go setup-binaries setup-schemastore
9494
setup-go:
9595
go build -o $(PACKAGE_PATH)/bin/ $(REPO_PATH)/golang/cmd/...
9696
setup-binaries: $(PACKAGE_PATH)/bin/slsa-verifier souffle gnu-sed
97+
98+
# Install SLSA Verifier.
99+
SLSA_VERIFIER_TAG := v2.7.1
100+
SLSA_VERIFIER_BIN := slsa-verifier-linux-amd64
101+
SLSA_VERIFIER_BIN_PATH := $(PACKAGE_PATH)/bin/$(SLSA_VERIFIER_BIN)
102+
SLSA_VERIFIER_PROVENANCE := $(SLSA_VERIFIER_BIN).intoto.jsonl
103+
SLSA_VERIFIER_PROVENANCE_PATH := $(PACKAGE_PATH)/bin/$(SLSA_VERIFIER_PROVENANCE)
104+
97105
$(PACKAGE_PATH)/bin/slsa-verifier:
98-
git clone --depth 1 https://github.com/slsa-framework/slsa-verifier.git -b v2.7.1
99-
cd slsa-verifier/cli/slsa-verifier && go build -o $(PACKAGE_PATH)/bin/
100-
cd $(REPO_PATH) && rm -rf slsa-verifier
106+
mkdir -p $(PACKAGE_PATH)/bin \
107+
&& wget -O $(PACKAGE_PATH)/bin/slsa-verifier https://github.com/slsa-framework/slsa-verifier/releases/download/$(SLSA_VERIFIER_TAG)/$(SLSA_VERIFIER_BIN) \
108+
&& wget -O $(SLSA_VERIFIER_PROVENANCE_PATH) https://github.com/slsa-framework/slsa-verifier/releases/download/$(SLSA_VERIFIER_TAG)/$(SLSA_VERIFIER_PROVENANCE) \
109+
&& chmod +x $(PACKAGE_PATH)/bin/slsa-verifier \
110+
&& EXPECTED_HASH=$$(jq -r '.payload' $(SLSA_VERIFIER_PROVENANCE_PATH) | base64 -d | jq -r '.subject[] | select(.name == "$(SLSA_VERIFIER_BIN)") | .digest.sha256') \
111+
&& ACTUAL_HASH=$$(sha256sum $(PACKAGE_PATH)/bin/slsa-verifier | awk '{print $$1}'); \
112+
if [ "$$EXPECTED_HASH" != "$$ACTUAL_HASH" ]; then \
113+
echo "Hash mismatch: expected $$EXPECTED_HASH, got $$ACTUAL_HASH"; \
114+
exit 1; \
115+
fi
116+
117+
# Set up schemastore for GitHub Actions specs.
101118
setup-schemastore: $(PACKAGE_PATH)/resources/schemastore/github-workflow.json $(PACKAGE_PATH)/resources/schemastore/LICENSE $(PACKAGE_PATH)/resources/schemastore/NOTICE
102119
$(PACKAGE_PATH)/resources/schemastore/github-workflow.json:
103120
cd $(PACKAGE_PATH)/resources \
@@ -257,15 +274,12 @@ requirements.txt: pyproject.toml
257274
# editable mode (like the one in development here) because they may not have
258275
# a PyPI entry; also print out CVE description and potential fixes if audit
259276
# found an issue.
260-
# Ignore GHSA-4xh5-x5gv-qwph since we are using Python >=3.11.14, which is not vulnerable to this
261-
# CVE. Remove this once a new version of pip that fixes the CVE is released.
262-
# See https://github.com/pypa/pip/issues/13607
263277
.PHONY: audit
264278
audit:
265279
if ! $$(python -c "import pip_audit" &> /dev/null); then \
266280
echo "No package pip_audit installed, upgrade your environment!" && exit 1; \
267281
fi;
268-
python -m pip_audit --skip-editable --desc on --fix --dry-run --ignore-vuln GHSA-4xh5-x5gv-qwph
282+
python -m pip_audit --skip-editable --desc on --fix --dry-run
269283

270284
# Run some or all checks over the package code base.
271285
.PHONY: check check-code check-bandit check-flake8 check-lint check-mypy check-go check-actionlint

docker/Dockerfile.final

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Note that the local machine must login to ghcr.io so that Docker could pull the ghcr.io/oracle/macaron-base
1212
# image for this build.
1313

14-
FROM ghcr.io/oracle/macaron-base:latest@sha256:e7cb431d2a870999b70a9a282a84e7b278f7a9ea91e60ba2a8efdab35b4b7e71
14+
FROM ghcr.io/oracle/macaron-base:latest@sha256:6d1d300d32060a75deffd2e6fce00e9f6d646df233f8df4deee2baf2982cf022
1515

1616
ENV HOME="/home/macaron"
1717

0 commit comments

Comments
 (0)