Skip to content

Commit e6aee3e

Browse files
authored
chore(deps): update base image, Python version to 3.11.14, and improve SLSA Verifier installation (#1257)
This PR updates the base image, upgrades Python to version 3.11.14 for security patches, and enhances the installation process of SLSA Verifier by adding provenance-based binary hash verification. Signed-off-by: behnazh-w <[email protected]>
1 parent ba45018 commit e6aee3e

File tree

10 files changed

+33
-19
lines changed

10 files changed

+33
-19
lines changed

.github/workflows/test_macaron_action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Setup Python for analyzed venv
6262
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
6363
with:
64-
python-version: 3.11.13
64+
python-version: 3.11.14
6565

6666
- name: Create and populate analyzed venv
6767
run: |

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Please see the [README for the malware analyzer](./src/macaron/malware_analyzer/
8484

8585
### Prerequisites
8686

87-
- Python 3.11.13
87+
- Python 3.11.14
8888
- Go 1.23
8989
- JDK 17
9090

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.13, 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

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ runs:
6161
- name: Setup Python
6262
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
6363
with:
64-
python-version: 3.11.13
64+
python-version: 3.11.14
6565

6666
- name: Setup Go
6767
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0

docker/Dockerfile.base

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
# to build and run the Docker image.
66
# This image is based on the container-registry.oracle.com/os/oraclelinux:9-slim image and contains the following
77
# components:
8-
# Python3.11.13 compiled and installed from source.
8+
# Python3.11.14 compiled and installed from source.
99
# Souffle 2.5 compiled and installed from source.
1010
# Other runtime libraries (e.g sqlite-devel) which are installed from dnf.
1111

12-
FROM container-registry.oracle.com/os/oraclelinux:9-slim@sha256:92deb326256d4d3053d210397b00dce9a423789d1c555adb7a3b7a1f0747ea2f
12+
FROM container-registry.oracle.com/os/oraclelinux:9-slim@sha256:41a867b7f24306cf38c01ba578598164397bd07aa26dbdc9a985bedd9177e82e
1313

1414
ENV HOME="/home/macaron" \
1515
# Setting Python related environment variables.
16-
PYTHON3_VERSION=3.11.13 \
16+
PYTHON3_VERSION=3.11.14 \
1717
PYTHONUNBUFFERED=1 \
1818
PYTHONDONTWRITEBYTECODE=1 \
1919
# https://github.com/docker-library/python/blob/f568f56f28fab0fe87b34db777e2c2861cef002b/3.11/slim-buster/Dockerfile#L12
@@ -62,7 +62,7 @@ enabled=1\
6262
# Exceptions (not installed):
6363
# mcpp - The package mcpp is not available in Oracle Linux 9. However, we don't use Souffle's feature
6464
# that needs it.
65-
# python3 - We use the installed Python3.11.13 for this.
65+
# python3 - We use the installed Python3.11.14 for this.
6666
gcc-c++ \
6767
libffi \
6868
libffi-devel \

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

docs/source/pages/supported_technologies/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Automatic dependency resolution
123123

124124
Currently, we support the following type of project for automatic dependency resolution.
125125

126-
* Python (with a Python virtual environment created and packages installed using Python3.11.13, see :ref:`providing Python virtual environment <python-venv-deps>`.)
126+
* Python (with a Python virtual environment created and packages installed using Python3.11.14, see :ref:`providing Python virtual environment <python-venv-deps>`.)
127127

128128
--------
129129
See also

docs/source/pages/tutorials/detect_malicious_package.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Macaron supports analyzing a package's dependencies and performs the same set of
190190

191191
Let's assume ``/tmp/.django_venv`` is the virtual environment where ``[email protected]`` is installed.
192192

193-
.. note:: If you want Macaron to analyze the virtual environment directly to identify the dependencies, we require Python 3.11.13 to be used to install the package. Alternatively, you can generate the SBOM as instructed :ref:`here <python-sbom>` and pass it to Macaron as input.
193+
.. note:: If you want Macaron to analyze the virtual environment directly to identify the dependencies, we require Python 3.11.14 to be used to install the package. Alternatively, you can generate the SBOM as instructed :ref:`here <python-sbom>` and pass it to Macaron as input.
194194

195195
Run Macaron as follows to analyze ``django`` and its direct dependencies.
196196

docs/source/pages/using.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ Where ``--python-venv`` is the path to virtual environment.
378378

379379
Alternatively, you can create an SBOM for the python package and provide it to Macaron as input as explained :ref:`here <with-sbom>`.
380380

381-
.. note:: We only support Python 3.11.13 for this feature of Macaron. Please make sure to install the package using this version of Python.
381+
.. note:: We only support Python 3.11.14 for this feature of Macaron. Please make sure to install the package using this version of Python.
382382

383383

384384
-----------------------------------------------

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "flit_core.buildapi"
99

1010
[project]
1111
name = "macaron"
12-
requires-python = ">=3.11.13"
12+
requires-python = ">=3.11.14"
1313
authors = [
1414
{"name" = "Trong Nhan Mai", "email" = "[email protected]"},
1515
{"name" = "Behnaz Hassanshahi", "email" = "[email protected]"},

0 commit comments

Comments
 (0)