Skip to content

Commit 531ef0a

Browse files
authored
Set up Zizmor (#70)
1 parent f98e837 commit 531ef0a

File tree

9 files changed

+104
-24
lines changed

9 files changed

+104
-24
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ updates:
55
directory: "/"
66
schedule:
77
interval: monthly
8+
cooldown:
9+
# https://blog.yossarian.net/2025/11/21/We-should-all-be-using-dependency-cooldowns
10+
# Cooldowns protect against supply chain attacks by avoiding the
11+
# highest-risk window immediately after new releases.
12+
default-days: 14
813
open-pull-requests-limit: 10

.github/workflows/build-and-push.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ jobs:
1717
permissions:
1818
contents: read
1919
packages: write
20+
env:
21+
CONTAINER: ${{ inputs.container }}
2022
steps:
2123
- name: Set Calver Date
2224
run: |
23-
echo "builddate=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
24-
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
25+
echo "builddate=$(date +'%Y.%m.%d')" >> "$GITHUB_OUTPUT"
26+
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
2527
id: version
2628
- name: Checkout
2729
uses: actions/checkout@v6
30+
with:
31+
persist-credentials: false
2832
- name: Set up QEMU
2933
uses: docker/setup-qemu-action@v3
3034
- name: Set up Docker Buildx
@@ -45,11 +49,13 @@ jobs:
4549
# https://specs.opencontainers.org/image-spec/annotations/#pre-defined-annotation-keys
4650
- name: Extract labels from Dockerfile
4751
id: labels
52+
env:
53+
CREATED: ${{ steps.version.outputs.created }}
4854
run: |
4955
set -euo pipefail
5056
5157
# Extract labels from the Dockerfile.
52-
DOCKERFILE=./${{ inputs.container }}/Dockerfile
58+
DOCKERFILE="./${CONTAINER}/Dockerfile"
5359
5460
# Function to extract a label value.
5561
extract_label() {
@@ -80,8 +86,8 @@ jobs:
8086
documentation=$(extract_label "documentation")
8187
8288
# Get dynamic values from earlier steps.
83-
created="${{ steps.version.outputs.created }}"
84-
revision="${{ github.sha }}"
89+
created="$CREATED"
90+
revision="$GITHUB_SHA"
8591
8692
# Build annotations string.
8793
annotations=""
@@ -97,11 +103,11 @@ jobs:
97103
add_annotation "revision" "$revision"
98104
99105
# Output the complete annotations string.
100-
echo "annotations=$annotations" >> $GITHUB_OUTPUT
106+
echo "annotations=$annotations" >> "$GITHUB_OUTPUT"
101107
- name: Build and push
102108
uses: docker/build-push-action@v6
103109
with:
104-
context: ./${{ inputs.container }}
110+
context: ./${{ env.CONTAINER }}
105111
platforms: linux/amd64,linux/arm64
106112
push: true
107113
tags: |

.github/workflows/ci.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
pull_request:
88
branches: [main]
99

10+
permissions: {}
11+
1012
jobs:
1113
build_dev_container:
1214
name: Build and test (Dev container)
@@ -21,6 +23,8 @@ jobs:
2123
steps:
2224
- name: Checkout
2325
uses: actions/checkout@v6
26+
with:
27+
persist-credentials: false
2428
- name: Set up Docker Buildx
2529
uses: docker/setup-buildx-action@v3
2630
- name: Build Dockerfile
@@ -30,7 +34,7 @@ jobs:
3034
load: true
3135
tags: ${{ env.TAG }}
3236
- name: Test clang
33-
run: docker run --rm ${{ env.TAG }} clang --version
37+
run: docker run --rm "$TAG" clang --version
3438

3539
build_wasi_container:
3640
name: Build and test (WASI container)
@@ -44,6 +48,8 @@ jobs:
4448
steps:
4549
- name: Checkout
4650
uses: actions/checkout@v6
51+
with:
52+
persist-credentials: false
4753
- name: Set up Docker Buildx
4854
uses: docker/setup-buildx-action@v3
4955
- name: Build Dockerfile
@@ -53,9 +59,9 @@ jobs:
5359
load: true
5460
tags: ${{ env.TAG }}
5561
- name: Test WASI SDK
56-
run: docker run --rm ${{ env.TAG }} /opt/wasi-sdk/bin/clang --version
62+
run: docker run --rm "$TAG" /opt/wasi-sdk/bin/clang --version
5763
- name: Test Wasmtime
58-
run: docker run --rm ${{ env.TAG }} wasmtime --version
64+
run: docker run --rm "$TAG" wasmtime --version
5965

6066
build_autoconf:
6167
name: Build and test (Autoconf)
@@ -70,6 +76,8 @@ jobs:
7076
steps:
7177
- name: Checkout
7278
uses: actions/checkout@v6
79+
with:
80+
persist-credentials: false
7381
- name: Set up Docker Buildx
7482
uses: docker/setup-buildx-action@v3
7583
- name: Build Dockerfile
@@ -80,4 +88,4 @@ jobs:
8088
load: true
8189
tags: ${{ env.TAG }}
8290
- name: Test
83-
run: docker run --rm $TAG autoconf --version | grep ${{ matrix.autoconf_version }}
91+
run: docker run --rm "$TAG" autoconf --version | grep ${{ matrix.autoconf_version }}

.github/workflows/lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions: {}
6+
7+
env:
8+
FORCE_COLOR: 1
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
persist-credentials: false
18+
- uses: j178/prek-action@v1

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ on:
1515

1616
run-name: "Release: ${{ inputs.container }}${{ inputs.container == 'devcontainer' && ' + wasicontainer' || '' }}"
1717

18+
permissions: {}
19+
1820
jobs:
1921
authorize:
2022
runs-on: ubuntu-latest
21-
if: contains('["brettcannon", "corona10", "erlend-aasland"]', github.actor)
23+
if: contains(fromJSON('["brettcannon", "corona10", "erlend-aasland"]'), github.actor)
2224
steps:
2325
- run: echo "Authorized"
2426

.github/zizmor.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Configuration for the zizmor static analysis tool, run via prek in CI
2+
# https://woodruffw.github.io/zizmor/configuration/
3+
rules:
4+
template-injection:
5+
ignore:
6+
- build-and-push.yml:108
7+
unpinned-uses:
8+
config:
9+
policies:
10+
"*": ref-pin

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-merge-conflict
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: forbid-submodules
11+
- id: trailing-whitespace
12+
13+
- repo: https://github.com/python-jsonschema/check-jsonschema
14+
rev: 0.36.2
15+
hooks:
16+
- id: check-dependabot
17+
- id: check-github-workflows
18+
19+
- repo: https://github.com/rhysd/actionlint
20+
rev: v1.7.11
21+
hooks:
22+
- id: actionlint
23+
24+
- repo: https://github.com/woodruffw/zizmor-pre-commit
25+
rev: v1.22.0
26+
hooks:
27+
- id: zizmor
28+
29+
- repo: meta
30+
hooks:
31+
- id: check-hooks-apply
32+
- id: check-useless-excludes

autoconf/ax_c_float_words_bigendian.diff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,31 @@ index 216b90d8..52036844 100644
5656
# permitted in any medium without royalty provided the copyright notice
5757
# and this notice are preserved. This file is offered as-is, without any
5858
# warranty.
59-
59+
6060
-#serial 11
6161
+#serial 14
62-
62+
6363
AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
6464
[AC_CACHE_CHECK(whether float word ordering is bigendian,
6565
ax_cv_c_float_words_bigendian, [
66-
66+
6767
ax_cv_c_float_words_bigendian=unknown
6868
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6969
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
7070
+
7171
+#include <stdlib.h>
7272
+
7373
+static double m[] = {9.090423496703681e+223, 0.0};
74-
74+
7575
-double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
7676
+int main (int argc, char *argv[])
7777
+{
7878
+ m[atoi (argv[1])] += atof (argv[2]);
7979
+ return m[atoi (argv[3])] > 0.0;
8080
+}
81-
81+
8282
]])], [
83-
83+
8484
-if grep noonsees conftest.$ac_objext >/dev/null ; then
8585
+if grep noonsees conftest* > /dev/null ; then
8686
ax_cv_c_float_words_bigendian=yes

autoconf/config.sub.patch

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ index 4aaae46..335706d 100755
3333
--- a/config.sub
3434
+++ b/config.sub
3535
@@ -4,7 +4,7 @@
36-
36+
3737
# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale
38-
38+
3939
-timestamp='2024-05-27'
4040
+timestamp='2025-01-06'
41-
41+
4242
# This file is free software; you can redistribute it and/or modify it
4343
# under the terms of the GNU General Public License as published by
4444
@@ -1194,7 +1194,7 @@ case $cpu-$vendor in
@@ -49,7 +49,7 @@ index 4aaae46..335706d 100755
4949
+ arm64-* | aarch64le-* | arm64_32-*)
5050
cpu=aarch64
5151
;;
52-
52+
5353
@@ -2249,6 +2249,8 @@ case $kernel-$os-$obj in
5454
;;
5555
*-eabi*- | *-gnueabi*-)
@@ -59,6 +59,5 @@ index 4aaae46..335706d 100755
5959
none--*)
6060
# None (no kernel, i.e. freestanding / bare metal),
6161
# can be paired with an machine code file format
62-
--
62+
--
6363
2.47.1
64-

0 commit comments

Comments
 (0)