From 28f71a21d14942d55530ac703db0b9248546aa01 Mon Sep 17 00:00:00 2001 From: Security maintenance Date: Sat, 7 Nov 2026 13:07:14 +0000 Subject: [PATCH] Verify human and Renovate PR routing without publishing --- .forgejo/workflows/c3-pr-policy.yml | 67 +++++++++++++++++++++++++++ .forgejo/workflows/docker-publish.yml | 29 ------------ .forgejo/workflows/shellcheck.yml | 24 ---------- 3 files changed, 67 insertions(+), 53 deletions(-) create mode 100644 .forgejo/workflows/c3-pr-policy.yml delete mode 100644 .forgejo/workflows/docker-publish.yml delete mode 100644 .forgejo/workflows/shellcheck.yml diff --git a/.forgejo/workflows/c3-pr-policy.yml b/.forgejo/workflows/c3-pr-policy.yml new file mode 100644 index 0000000..83674ed --- /dev/null +++ b/.forgejo/workflows/c3-pr-policy.yml @@ -0,0 +1,67 @@ +name: C3 PR policy verification +'on': + pull_request: + branches: + - main +jobs: + route: + runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login + == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, + 'renovate/')) && 'renovate' || 'docker' }} + if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) + && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'), + github.event.pull_request.user.login)) }} + env: + CI_UNTRUSTED: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login + == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, + 'renovate/')) }} + REGISTRY_TOKEN: ${{ !(github.actor == 'renovate-bot' || github.event.pull_request.user.login + == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, + 'renovate/')) && secrets.FORGEJO_PACKAGE_TOKEN || '' }} + steps: + - name: Verify identity routing and credential boundary + run: "set -eu\ntest ! -S /var/run/docker.sock\ntest ! -e /pages\nawk '$1 ==\ + \ 0 { if ($2 == 0) exit 1; found=1 } END { if (!found) exit 1 }' /proc/self/uid_map\n\ + if [ \"$CI_UNTRUSTED\" = true ]; then\n test -z \"$REGISTRY_TOKEN\"\n echo\ + \ BOT_SECRET_FREE_ROOTLESS_OK\nelse\n test -n \"$REGISTRY_TOKEN\"\n echo\ + \ HUMAN_FULL_CONTAINER_OK\nfi\nmkdir context\nprintf 'FROM docker.io/library/alpine:3.22\\\ + nRUN echo verified >/proof\\n' >context/Dockerfile\n" + - name: Build without publishing or registry credentials + uses: https://git.schmelczer.dev/andras/ci-actions/docker-publish@c80f2f0701d7618f1f0b2bb52ebd332ea34b6e28 + with: + context: context + push: 'false' + full-environment: + runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login + == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, + 'renovate/')) && 'renovate-ubuntu' || 'ubuntu-latest' }} + if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) + && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'), + github.event.pull_request.user.login)) }} + steps: + - run: 'set -eu + + . /etc/os-release + + test "$ID" = ubuntu + + sudo -n true + + node --version + + git --version + + test ! -S /var/run/docker.sock + + echo FULL_CI_IMAGE_OK + + ' + trusted-release-gate: + runs-on: docker + if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) + && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'), + github.event.pull_request.user.login)) && !(github.actor == 'renovate-bot' || + github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, + 'refs/heads/renovate/') || startsWith(github.head_ref, 'renovate/')) }} + steps: + - run: echo TRUSTED_HUMAN_GATE_OK diff --git a/.forgejo/workflows/docker-publish.yml b/.forgejo/workflows/docker-publish.yml deleted file mode 100644 index 2d90f9e..0000000 --- a/.forgejo/workflows/docker-publish.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Docker - -on: - push: - branches: ["main"] - tags: ['v*.*.*'] - pull_request: - branches: ["main"] - -jobs: - build: - runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, - 'renovate/')) && 'renovate' || 'docker' }} - steps: - - name: Checkout repository - uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 - - with: - persist-credentials: false - - name: Build and publish image - uses: https://git.schmelczer.dev/andras/ci-actions/docker-publish@c80f2f0701d7618f1f0b2bb52ebd332ea34b6e28 - with: - context: . - push: ${{ !(github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || - startsWith(github.head_ref, 'renovate/')) && (github.event_name != 'pull_request') }} - token: ${{ !(github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') - || startsWith(github.head_ref, 'renovate/')) && (secrets.FORGEJO_PACKAGE_TOKEN) || '' }} - if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'), - github.event.pull_request.user.login)) }} diff --git a/.forgejo/workflows/shellcheck.yml b/.forgejo/workflows/shellcheck.yml deleted file mode 100644 index a3480f1..0000000 --- a/.forgejo/workflows/shellcheck.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: ShellCheck - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - shellcheck: - runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref, - 'renovate/')) && 'renovate' || 'docker' }} - steps: - - uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 - - with: - persist-credentials: false - - name: Install ShellCheck - run: apt-get update && apt-get install -y shellcheck - - - name: Run ShellCheck - run: find ./src -name '*.sh' -exec shellcheck {} + - if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'), - github.event.pull_request.user.login)) }}