Skip to content

Commit 17dbe71

Browse files
committed
fix(ci): address zizmor template injection findings
Signed-off-by: Simon Scatton <[email protected]>
1 parent cdb223c commit 17dbe71

11 files changed

Lines changed: 64 additions & 31 deletions

File tree

‎.github/actions/build-docker-image/action.yml‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ runs:
3636

3737
- name: Log in to GHCR
3838
shell: bash
39-
run: echo "${{ inputs.github-token }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
39+
run: echo "${INPUTS_GITHUB_TOKEN}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
40+
env:
41+
INPUTS_GITHUB_TOKEN: ${{ inputs.github-token }}
4042

4143
- name: Download ${{ inputs.binary }}
4244
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -46,21 +48,27 @@ runs:
4648

4749
- name: Stage ${{ inputs.binary }}
4850
shell: bash
49-
run: install -Dm0755 artifact/${{ inputs.binary }} deploy/docker/.build/prebuilt-binaries/${{ inputs.arch }}/${{ inputs.binary }}
51+
run: install -Dm0755 artifact/${INPUTS_BINARY} deploy/docker/.build/prebuilt-binaries/${INPUTS_ARCH}/${INPUTS_BINARY}
52+
env:
53+
INPUTS_BINARY: ${{ inputs.binary }}
54+
INPUTS_ARCH: ${{ inputs.arch }}
5055

5156
- name: Build ${{ inputs.component }} image
5257
shell: bash
5358
env:
5459
IMAGE_TAG: ${{ inputs.image-tag }}
60+
INPUTS_PLATFORM: ${{ inputs.platform }}
61+
INPUTS_COMPONENT: ${{ inputs.component }}
62+
INPUTS_ARCH: ${{ inputs.arch }}
5563
run: |
5664
docker buildx build \
5765
--builder openshell \
58-
--platform ${{ inputs.platform }} \
59-
--file deploy/docker/Dockerfile.${{ inputs.component }} \
60-
--target ${{ inputs.component }} \
61-
--tag ghcr.io/nvidia/openshell/${{ inputs.component }}:${IMAGE_TAG}-${{ inputs.arch }} \
62-
--cache-from type=gha,scope=${{ inputs.component }}-${{ inputs.arch }} \
63-
--cache-to type=gha,mode=max,scope=${{ inputs.component }}-${{ inputs.arch }} \
66+
--platform ${INPUTS_PLATFORM} \
67+
--file deploy/docker/Dockerfile.${INPUTS_COMPONENT} \
68+
--target ${INPUTS_COMPONENT} \
69+
--tag ghcr.io/nvidia/openshell/${INPUTS_COMPONENT}:${IMAGE_TAG}-${INPUTS_ARCH} \
70+
--cache-from type=gha,scope=${INPUTS_COMPONENT}-${INPUTS_ARCH} \
71+
--cache-to type=gha,mode=max,scope=${INPUTS_COMPONENT}-${INPUTS_ARCH} \
6472
--provenance=mode=min \
6573
--attest type=sbom \
6674
--output type=image,push=true,oci-mediatypes=true,oci-artifact=true \

‎.github/actions/build-rust-binary/action.yml‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,34 +58,46 @@ runs:
5858

5959
- name: Set version
6060
shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0}
61-
run: sed -i 's/^version = "0\.0\.0"$/version = "${{ inputs.cargo-version }}"/' Cargo.toml
61+
env:
62+
INPUTS_CARGO_VERSION: ${{ inputs.cargo-version }}
63+
run: sed -i "s/^version = \"0\\.0\\.0\"$/version = \"${INPUTS_CARGO_VERSION}\"/" Cargo.toml
6264

6365
- name: Build ${{ inputs.binary }}
6466
shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0}
6567
env:
6668
OPENSHELL_IMAGE_TAG: ${{ inputs.image-tag }}
67-
run: GIT_DIR=/nonexistent cargo auditable build --release --package "${{ inputs.package }}" --bin "${{ inputs.binary }}" ${{ inputs.extra-cargo-flags }}
69+
INPUTS_PACKAGE: ${{ inputs.package }}
70+
INPUTS_BINARY: ${{ inputs.binary }}
71+
INPUTS_EXTRA_CARGO_FLAGS: ${{ inputs.extra-cargo-flags }}
72+
run: GIT_DIR=/nonexistent cargo auditable build --release --package "${INPUTS_PACKAGE}" --bin "${INPUTS_BINARY}" ${INPUTS_EXTRA_CARGO_FLAGS}
6873

6974
- name: Verify ${{ inputs.binary }}
7075
shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0}
76+
env:
77+
INPUTS_BINARY: ${{ inputs.binary }}
7178
run: |
7279
# Confirm the binary runs and reports the expected name.
73-
target/release/${{ inputs.binary }} --version | grep -q '^${{ inputs.binary }} '
80+
target/release/${INPUTS_BINARY} --version | grep -q "^${INPUTS_BINARY} "
7481
# Confirm Syft can decode the embedded cargo-auditable metadata.
75-
SYFT_CHECK_FOR_APP_UPDATE=false syft file:target/release/${{ inputs.binary }} -o cyclonedx-json | grep 'pkg:cargo/' > /dev/null
82+
SYFT_CHECK_FOR_APP_UPDATE=false syft file:target/release/${INPUTS_BINARY} -o cyclonedx-json | grep 'pkg:cargo/' > /dev/null
7683
7784
- name: Verify static linkage
7885
if: endsWith(inputs.triple, '-linux-musl')
7986
shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0}
80-
run: tasks/scripts/verify-static-binary.sh target/release/${{ inputs.binary }}
87+
env:
88+
INPUTS_BINARY: ${{ inputs.binary }}
89+
run: tasks/scripts/verify-static-binary.sh target/release/${INPUTS_BINARY}
8190

8291
- name: Normalize Linux dynamic binary
8392
if: endsWith(inputs.triple, '-linux-gnu')
8493
shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0}
94+
env:
95+
INPUTS_BINARY: ${{ inputs.binary }}
96+
INPUTS_INTERPRETER: ${{ inputs.interpreter }}
8597
run: |
86-
binary=target/release/${{ inputs.binary }}
98+
binary=target/release/${INPUTS_BINARY}
8799
# Remove Nix store paths so the binary can run on other distributions.
88-
patchelf --set-interpreter "${{ inputs.interpreter }}" --remove-rpath "$binary"
100+
patchelf --set-interpreter "${INPUTS_INTERPRETER}" --remove-rpath "$binary"
89101
# Z3 must be embedded instead of loaded from the target system.
90102
test -z "$(patchelf --print-needed "$binary" | grep '^libz3')"
91103
# Reject symbols introduced after glibc 2.28.

‎.github/actions/setup-e2e-driver/action.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ runs:
2121
- name: Configure prebuilt ${{ inputs.binary }}
2222
shell: bash
2323
run: |
24-
driver="$GITHUB_WORKSPACE/.e2e/prebuilt-driver/${{ inputs.binary }}"
24+
driver="$GITHUB_WORKSPACE/.e2e/prebuilt-driver/${INPUTS_BINARY}"
2525
chmod +x "$driver"
2626
"$driver" --version
2727
echo "OPENSHELL_EXTERNAL_DRIVER_BIN=$driver" >> "$GITHUB_ENV"
28+
env:
29+
INPUTS_BINARY: ${{ inputs.binary }}

‎.github/actions/setup-e2e-podman/action.yml‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ runs:
3838
openssh-client \
3939
passt \
4040
pkg-config \
41-
"conmon=${{ inputs.conmon-package-version }}" \
42-
"podman=${{ inputs.podman-package-version }}" \
41+
"conmon=${INPUTS_CONMON_PACKAGE_VERSION}" \
42+
"podman=${INPUTS_PODMAN_PACKAGE_VERSION}" \
4343
uidmap
4444
# Hosted runners can place newer binaries under /usr/local. Select the
4545
# distro CLI and use Podman's supported final conmon-path override.
@@ -50,6 +50,9 @@ runs:
5050
> "${podman_config}"
5151
echo "/usr/bin" >> "${GITHUB_PATH}"
5252
echo "CONTAINERS_CONF_OVERRIDE=${podman_config}" >> "${GITHUB_ENV}"
53+
env:
54+
INPUTS_CONMON_PACKAGE_VERSION: ${{ inputs.conmon-package-version }}
55+
INPUTS_PODMAN_PACKAGE_VERSION: ${{ inputs.podman-package-version }}
5356

5457
- name: Allow pasta to receive Podman stop signals
5558
shell: bash
@@ -85,11 +88,11 @@ runs:
8588
set -euo pipefail
8689
podman_version="$(podman version --format '{{.Client.Version}}')"
8790
case "$podman_version" in
88-
"${{ inputs.podman-major }}".*) ;;
89-
*) echo "ERROR: expected Podman ${{ inputs.podman-major }}.x, found $podman_version" >&2; exit 1 ;;
91+
"${INPUTS_PODMAN_MAJOR}".*) ;;
92+
*) echo "ERROR: expected Podman ${INPUTS_PODMAN_MAJOR}.x, found $podman_version" >&2; exit 1 ;;
9093
esac
91-
test "$(dpkg-query -W -f='${Version}' podman)" = "${{ inputs.podman-package-version }}"
92-
test "$(dpkg-query -W -f='${Version}' conmon)" = "${{ inputs.conmon-package-version }}"
94+
test "$(dpkg-query -W -f='${Version}' podman)" = "${INPUTS_PODMAN_PACKAGE_VERSION}"
95+
test "$(dpkg-query -W -f='${Version}' conmon)" = "${INPUTS_CONMON_PACKAGE_VERSION}"
9396
test "$(command -v podman)" = "/usr/bin/podman"
9497
test "$(podman info --format '{{.Host.Conmon.Path}}')" = "/usr/bin/conmon"
9598
test "$(podman info --format '{{.Host.Security.Rootless}}')" = "true"
@@ -103,6 +106,10 @@ runs:
103106
echo "=== Podman ==="
104107
podman version
105108
podman info --debug
109+
env:
110+
INPUTS_PODMAN_MAJOR: ${{ inputs.podman-major }}
111+
INPUTS_PODMAN_PACKAGE_VERSION: ${{ inputs.podman-package-version }}
112+
INPUTS_CONMON_PACKAGE_VERSION: ${{ inputs.conmon-package-version }}
106113

107114
- name: Probe rootless capability bounding set
108115
shell: bash

‎.github/workflows/deb-package.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ jobs:
7676
OPENSHELL_CLI_BINARY="${PWD}/package-binaries/openshell" \
7777
OPENSHELL_GATEWAY_BINARY="${PWD}/package-binaries/openshell-gateway" \
7878
OPENSHELL_DRIVER_VM_BINARY="${PWD}/package-binaries/openshell-driver-vm" \
79-
OPENSHELL_DEB_VERSION="${{ inputs['deb-version'] }}" \
79+
OPENSHELL_DEB_VERSION="${INPUTS_DEB_VERSION}" \
8080
OPENSHELL_DEB_ARCH="${{ matrix.deb_arch }}" \
8181
OPENSHELL_OUTPUT_DIR=artifacts \
8282
tasks/scripts/package-deb.sh
83+
env:
84+
INPUTS_DEB_VERSION: ${{ inputs['deb-version'] }}
8385

8486
- name: Upload Debian package artifact
8587
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7

‎.github/workflows/docker-build.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ jobs:
7272

7373
- name: Log in to GHCR
7474
shell: bash
75-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
75+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
7676

7777
- name: Create manifest
7878
shell: bash
7979
env:
8080
IMAGE_TAG: ${{ inputs.image-tag || github.sha }}
81+
INPUTS_COMPONENT: ${{ inputs.component }}
8182
run: |
82-
image=ghcr.io/nvidia/openshell/${{ inputs.component }}
83+
image=ghcr.io/nvidia/openshell/${INPUTS_COMPONENT}
8384
docker buildx imagetools create \
8485
--prefer-index=false \
8586
--tag "$image:${IMAGE_TAG}" \

‎.github/workflows/e2e-docker-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
rm -rf /var/lib/apt/lists/*
9898
9999
- name: Log in to GHCR
100-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
100+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
101101

102102
- name: Install Python dependencies and generate protobuf stubs
103103
if: matrix.python_proto

‎.github/workflows/e2e-podman-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
conmon-package-version: ${{ matrix.conmon_package_version }}
7171

7272
- name: Log in to GHCR
73-
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u "${{ github.actor }}" --password-stdin
73+
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
7474

7575
- name: Run tests
7676
run: ${{ matrix.cmd }}

‎.github/workflows/release-dev.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
timeout-minutes: 10
161161
steps:
162162
- name: Log in to GHCR
163-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
163+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
164164

165165
- name: Tag images as dev
166166
run: |

‎.github/workflows/release-tag.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ jobs:
192192
timeout-minutes: 10
193193
steps:
194194
- name: Log in to GHCR
195-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
195+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
196196

197197
- name: Tag images with version and latest
198198
run: |

0 commit comments

Comments
 (0)