fix(ci): keep the updater key out of pull-request runs

entry-pr-translate.yml ran the pull request's own code and then minted a token from BOT_APP_PRIVATE_KEY in the same job, so any same-repository PR could read the updater key. Translation now uses a separate App (TRANSLATE_APP_CLIENT_ID, TRANSLATE_APP_PRIVATE_KEY) that sits on no bypass list. Every job that mints an updater token (seven in cron-update.yml, one in cron-collection-source.yml) declares environment: updater, restricted to main, so BOT_APP_* can live as environment secrets only. secrets.md, configuration.md and workflows.md document the new secrets, the second updater workflow and the admin role on the update-branch ruleset.

🎯 Fix: 90 %
💥 Break: 3 %
💸 Tokens: 104 %
⏱️ Velocity: 108 %
🛡️ Security: 100 %
🏆 Score: 78
🚦 Gate: ⚠️ tokens 104 % > 100, velocity 108 % > 100: operator approved via hub decision 4b87e2f7793bdb4b

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-11-27 11:20:27 +00:00
1 parent 7fea39f2ad
commit c578f3111a
6 files changed
+37 -17

No files matched your search

@@ -19,6 +19,7 @@ jobs:
name: ⚖️ Time Galaxy against the git fallback
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
env:
HISTORY_PATH: build/collection-source-history.json
steps:
+7
View File
@@ -22,6 +22,7 @@ jobs:
name: 🐳 Update Docker image versions
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
@@ -69,6 +70,7 @@ jobs:
name: 🐳 Update compose file image versions
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
@@ -116,6 +118,7 @@ jobs:
name: 🔖 Update declared version sources
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
@@ -163,6 +166,7 @@ jobs:
name: 🐍 Update pinned pip requirements
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
@@ -210,6 +214,7 @@ jobs:
name: 🌌 Update pinned Ansible collections
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
@@ -257,6 +262,7 @@ jobs:
name: 🌿 Update repository refs
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
@@ -304,6 +310,7 @@ jobs:
name: 🏃 Update GitHub-hosted runner labels
if: vars.CI_ENABLE_AUTO_UPDATES == 'true'
runs-on: ubuntu-26.04
environment: updater
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v7.0.0
+2 -2
View File
@@ -126,8 +126,8 @@ jobs:
id: app-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.BOT_APP_CLIENT_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
client-id: ${{ secrets.TRANSLATE_APP_CLIENT_ID }}
private-key: ${{ secrets.TRANSLATE_APP_PRIVATE_KEY }}
- name: 📂 Open PR for the translated catalogs
if: steps.diff.outputs.changed == 'true'
@@ -127,7 +127,7 @@ The gate is applied inside [push_ci_policy.sh](../../../../../scripts/meta/resol
Controls whether automated update PRs are created. Covers both the workflow-driven jobs in [cron-update.yml](../../../../../.github/workflows/cron-update.yml) (Docker image versions, agent skills) and PRs opened by Dependabot (gated via [entry-pr-open-dependabot-close.yml](../../../../../.github/workflows/entry-pr-open-dependabot-close.yml), which auto-closes them).
The workflow-driven jobs additionally require the `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` repository secrets, see [secrets.md](secrets.md). Without those secrets, runs fail at the token-minting step and no PR is opened.
The workflow-driven jobs additionally require the `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` secrets of the `updater` environment, see [secrets.md](secrets.md). Without those secrets, runs fail at the token-minting step and no PR is opened.
**Default behaviour (variable not set or set to any value other than `true`):**
The `update-docker-image-versions` job is skipped. Dependabot PRs are auto-closed on open with a comment pointing to this variable.
@@ -2,14 +2,16 @@
This page lists every repository secret that GitHub Actions workflows in this repository consume, and documents the failure mode when a secret is missing. For repository **variables** see [configuration.md](configuration.md). For the workflow catalog see [workflows.md](workflows.md).
Repository secrets MUST be set under **Settings → Secrets and variables → Actions → Secrets**.
Repository secrets MUST be set under **Settings → Secrets and variables → Actions → Secrets**; environment secrets under **Settings → Environments → `<name>` → Environment secrets**.
## Secrets 📋
| Secret | Workflow | Purpose | Required when |
|---|---|---|---|
| `BOT_APP_CLIENT_ID` | [cron-update.yml](../../../../../.github/workflows/cron-update.yml) | GitHub App Client ID (OAuth-style `Iv…` identifier shown on the App's General page) used to mint a short-lived installation token for the update PR. | `CI_ENABLE_AUTO_UPDATES == 'true'` |
| `BOT_APP_PRIVATE_KEY` | [cron-update.yml](../../../../../.github/workflows/cron-update.yml) | PEM-encoded private key of the same GitHub App. Used to sign the JWT that exchanges for the installation token. | `CI_ENABLE_AUTO_UPDATES == 'true'` |
| `BOT_APP_CLIENT_ID` | [cron-update.yml](../../../../../.github/workflows/cron-update.yml), [cron-collection-source.yml](../../../../../.github/workflows/cron-collection-source.yml) | GitHub App Client ID (OAuth-style `Iv…` identifier shown on the App's General page) used to mint a short-lived installation token for the update PR. An **environment** secret of `updater`, never a repository secret. | `CI_ENABLE_AUTO_UPDATES == 'true'` |
| `BOT_APP_PRIVATE_KEY` | [cron-update.yml](../../../../../.github/workflows/cron-update.yml), [cron-collection-source.yml](../../../../../.github/workflows/cron-collection-source.yml) | PEM-encoded private key of the same GitHub App. Used to sign the JWT that exchanges for the installation token. An environment secret of `updater`. | `CI_ENABLE_AUTO_UPDATES == 'true'` |
| `TRANSLATE_APP_CLIENT_ID` | [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml) | Client ID of the translation App that opens the machine-translation PRs. A repository secret, readable by same-repository pull requests. | `CI_ENABLE_AUTO_TRANSLATIONS == 'true'` |
| `TRANSLATE_APP_PRIVATE_KEY` | [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml) | PEM private key of the translation App. | `CI_ENABLE_AUTO_TRANSLATIONS == 'true'` |
| `MERGE_APP_CLIENT_ID` | [entry-pr-green-update-merge.yml](../../../../../.github/workflows/entry-pr-green-update-merge.yml) | Client ID of the separate merge App, an **environment** secret of `auto-merge`, never a repository secret. | `CI_ENABLE_AUTO_UPDATES == 'true'` |
| `MERGE_APP_PRIVATE_KEY` | [entry-pr-green-update-merge.yml](../../../../../.github/workflows/entry-pr-green-update-merge.yml) | PEM private key of the merge App, an environment secret of `auto-merge`. | `CI_ENABLE_AUTO_UPDATES == 'true'` |
| `API_OPENAI_KEY` | [call-test-deploy.yml](../../../../../.github/workflows/call-test-deploy.yml) | Publishes the `openai/*` models on the LiteLLM gateway and lets the CLI test exercise the route. | Never. Unset leaves the route unpublished. |
@@ -92,16 +94,26 @@ A classic personal access token MAY be used as a fallback for unrelated automati
### How to hand the credentials to CI 📥
1. Open the repository on GitHub.
2. Go to **Settings → Secrets and variables → Actions**.
3. Stay on the **Secrets** tab.
4. Click **New repository secret** and add `BOT_APP_CLIENT_ID` with the App's Client ID (shown on the App's General page under **About**, in the `Iv…` format — *not* the numeric App ID).
5. Click **New repository secret** and add `BOT_APP_PRIVATE_KEY` with the complete PEM content, including the `-----BEGIN PRIVATE KEY-----` and `-----END PRIVATE KEY-----` lines.
2. Go to **Settings → Environments → New environment**, name it `updater`, and under **Deployment branches and tags** choose **Selected branches and tags** with the single rule `main`.
3. Under **Environment secrets**, add `BOT_APP_CLIENT_ID` with the App's Client ID (shown on the App's General page under **About**, in the `Iv…` format, *not* the numeric App ID).
4. Add `BOT_APP_PRIVATE_KEY` with the complete PEM content, including the `-----BEGIN PRIVATE KEY-----` and `-----END PRIVATE KEY-----` lines.
5. Delete any repository secret of the same names under **Settings → Secrets and variables → Actions**; a repository secret would stay readable by `pull_request` runs.
### How the workflow consumes the secrets ⚙️
Each PR-opening job in [cron-update.yml](../../../../../.github/workflows/cron-update.yml) runs an `actions/create-github-app-token@v2` step gated on `steps.diff.outputs.changed == 'true'`, then forwards the minted token as `GH_TOKEN` and the resolved `APP_SLUG` to the subsequent PR step. The job's `permissions:` block keeps the workflow-provided `GITHUB_TOKEN` read-only; write access is provided exclusively by the App token, scoped to the App's repository permissions.
Each PR-opening job in [cron-update.yml](../../../../../.github/workflows/cron-update.yml) and [cron-collection-source.yml](../../../../../.github/workflows/cron-collection-source.yml) declares `environment: updater` and runs an `actions/create-github-app-token@v3` step gated on `steps.diff.outputs.changed == 'true'`, then forwards the minted token as `GH_TOKEN` and the resolved `APP_SLUG` to the subsequent PR step. The job's `permissions:` block keeps the workflow-provided `GITHUB_TOKEN` read-only; write access is provided exclusively by the App token, scoped to the App's repository permissions.
This App MUST NOT be a bypass actor of the `Main` ruleset: [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml) mints its token on `pull_request`, where a same-repository PR can change the workflow and read the key.
These jobs run on `push` to `main`, `schedule` or `workflow_dispatch` and check out `main`; a dispatch on any other branch fails at the environment's branch rule. No job that declares `updater` may check out or execute pull-request code.
This App MUST NOT be a bypass actor of the `Main` ruleset. It is the only bypass actor of the update-branch ruleset, see [Prerequisites for the bypass](#prerequisites-for-the-bypass-).
## `TRANSLATE_APP_CLIENT_ID` and `TRANSLATE_APP_PRIVATE_KEY` 🌐
[entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml) mints its token on `pull_request` after running the pull request's own code, so any same-repository pull request can read this key. It therefore belongs to an App of its own that sits on no bypass list: a leaked key grants what every writer already has, and it opens only `translate/pr-*` branches.
1. Create the App as in [How to generate the App](#how-to-generate-the-app-), with `Contents` and `Pull requests`: **Read and write**. Install it on the `core` repository only.
2. Add `TRANSLATE_APP_CLIENT_ID` and `TRANSLATE_APP_PRIVATE_KEY` as **repository** secrets.
3. Never add this App to the bypass list of any ruleset.
### Commit identity propagation 🪪
@@ -134,10 +146,10 @@ The behaviour is fail-loud by design. Missing or mistyped secret names MUST surf
### Prerequisites for the bypass 🔒
The merge gate checks who opened the PR, not who pushed its head commit, so the head of an `update/*` or `dependabot/*` branch MUST be writable by the updater App and Dependabot alone, and the updater key MUST be out of reach of every pull request:
The merge gate checks who opened the PR, not who pushed its head commit, so the head of an `update/*` or `dependabot/*` branch MUST be writable by the updater App, Dependabot and admins alone, and the updater key MUST be out of reach of every pull request:
1. A branch ruleset on `update/**` and `dependabot/**` restricts creation, updates and deletion, with only the updater App and Dependabot on its bypass list.
2. [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml) mints its token from an App of its own, and `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` move into an environment restricted to `main`, so no `pull_request` run can read them. As with `auto-merge`, a `pull_request_target` or `workflow_run` job passes that branch rule, so no job that declares the environment may check out or execute pull-request code; list every workflow that declares it and confirm this before step 4.
1. A branch ruleset on `update/**` and `dependabot/**` restricts creation, updates and deletion, with only the updater App, Dependabot and the admin role on its bypass list. The admin role lets a maintainer merge a translation PR or push a fixup onto an update branch; the translation App stays off it.
2. `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` exist only as secrets of the `updater` environment, restricted to `main`, and no longer as repository secrets, so no `pull_request` run can read them; [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml) uses the [translation App](#translate_app_client_id-and-translate_app_private_key-). As with `auto-merge`, a `pull_request_target` or `workflow_run` job passes that branch rule, so no job that declares the environment may check out or execute pull-request code; list every workflow that declares it and confirm this before step 4.
With both in place, pushing a head the gate accepts needs the updater key, which only workflows on `main` can read. Until then the merge App stays off the bypass list, the merge call fails with HTTP 405, and update PRs wait for a manual merge: the ruleset's `update` rule (Restrict updates) lets only bypass actors move `main`, pull-request merges included, whatever reviews the PR holds.
@@ -83,8 +83,8 @@ Trigger column legend: **auto** = fires automatically (push, pull_request, sched
| [call-release-version.yml](../../../../../.github/workflows/call-release-version.yml): `🚀 Release: Version Logic` | Releases a specific version tag (build + publish). Called from `entry-push-latest.yml` on tagged pushes. | reusable, manual | `tag` (required, e.g. `v1.2.3`) |
| [cron-release-highest.yml](../../../../../.github/workflows/cron-release-highest.yml): `🚀 Release missing tag` | Scheduled backfill: finds the highest tag without a release and triggers `call-release-version.yml` for it. | auto (`schedule`: daily 00:00 UTC), manual | none |
| [cron-cleanup-stale.yml](../../../../../.github/workflows/cron-cleanup-stale.yml): `🧹 Prune stale data` | Marks and closes stale issues and PRs, deletes inactive branches, and prunes old GHCR CI image versions. | auto (`schedule`: daily 00:00 UTC), manual | none |
| [cron-update.yml](../../../../../.github/workflows/cron-update.yml): `🔄 Update versions` | Updates Docker image versions and other pinned dependencies; opens an update PR via a GitHub App installation token so PR-lifecycle events fire on the resulting PR. Both jobs are gated behind the `CI_ENABLE_AUTO_UPDATES` repository variable, see [configuration.md](configuration.md). Requires the `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` repository secrets, see [secrets.md](secrets.md). | auto (`push` to `main`, `schedule`: daily 00:30 UTC), manual | none |
| [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml): `🌐 Translate catalogs` | Merges the source strings of the `core` and `docs` domains into `locale/`, then machine-translates what a pull request leaves empty or fuzzy, one runner per language LibreTranslate supports. Each runner opens its own PR against the head branch of the triggering PR. Gated behind the `CI_ENABLE_AUTO_TRANSLATIONS` repository variable, see [configuration.md](configuration.md); pull requests from a fork are skipped. Requires the `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` repository secrets, see [secrets.md](secrets.md). | auto (`pull_request` against `main`: opened, synchronize, reopened) | none |
| [cron-update.yml](../../../../../.github/workflows/cron-update.yml): `🔄 Update versions` | Updates Docker image versions and other pinned dependencies; opens an update PR via a GitHub App installation token so PR-lifecycle events fire on the resulting PR. Both jobs are gated behind the `CI_ENABLE_AUTO_UPDATES` repository variable, see [configuration.md](configuration.md). Requires the `BOT_APP_CLIENT_ID` and `BOT_APP_PRIVATE_KEY` secrets of the `updater` environment, see [secrets.md](secrets.md). | auto (`push` to `main`, `schedule`: daily 00:30 UTC), manual | none |
| [entry-pr-translate.yml](../../../../../.github/workflows/entry-pr-translate.yml): `🌐 Translate catalogs` | Merges the source strings of the `core` and `docs` domains into `locale/`, then machine-translates what a pull request leaves empty or fuzzy, one runner per language LibreTranslate supports. Each runner opens its own PR against the head branch of the triggering PR. Gated behind the `CI_ENABLE_AUTO_TRANSLATIONS` repository variable, see [configuration.md](configuration.md); pull requests from a fork are skipped. Requires the `TRANSLATE_APP_CLIENT_ID` and `TRANSLATE_APP_PRIVATE_KEY` repository secrets of a separate App, see [secrets.md](secrets.md). | auto (`pull_request` against `main`: opened, synchronize, reopened) | none |
| [entry-pr-open-dependabot-close.yml](../../../../../.github/workflows/entry-pr-open-dependabot-close.yml): `🚫 Dependabot: Close while auto-updates disabled` | Auto-closes Dependabot PRs while `CI_ENABLE_AUTO_UPDATES` is not set to `true`, so Dependabot honours the same gate as the workflow-driven update jobs. See [configuration.md](configuration.md). | auto (`pull_request_target`: opened, reopened) | none |
| [entry-pr-change-dependabot-label.yml](../../../../../.github/workflows/entry-pr-change-dependabot-label.yml): `🔄 Dependabot: Label update level` | Labels every Dependabot PR `⬆️ update` plus exactly one of `🔴 major`, `🟡 minor` and `🟢 patch`, read from the `update-type` of `dependabot/fetch-metadata`; a type that names no semver level counts as `major`. Creates a missing label, adds only labels the PR lacks and checks out the base branch only. Gated behind `CI_ENABLE_AUTO_UPDATES`, see [configuration.md](configuration.md). | auto (`pull_request_target`: opened, reopened, synchronize) | none |
| [entry-pr-green-update-merge.yml](../../../../../.github/workflows/entry-pr-green-update-merge.yml): `🔄 Update: Merge proven PRs` | Runs when a `🔀 Pull Request` run of the `pull_request` event succeeds on an `update/*` or `dependabot/*` branch. [cli.contributing.update.merge](../../../../../cli/contributing/update/merge/__main__.py) merges the PR only when the `infinito-nexus-updater[bot]` App or `dependabot[bot]` opened it, it carries `⬆️ update`, every check run and commit status on its head is green, and the run's `role-runtimes-*` artifacts list every role the PR changes. Otherwise it prints why and the PR stays open for a manual merge. The merge pins the tested head and uses the token of a separate merge App, which becomes a bypass actor of the `Main` ruleset only once the prerequisites in [secrets.md](secrets.md#prerequisites-for-the-bypass-) hold; until then the PR waits for a manual merge. Gated behind `CI_ENABLE_AUTO_UPDATES`, see [configuration.md](configuration.md); requires the `MERGE_APP_CLIENT_ID` and `MERGE_APP_PRIVATE_KEY` secrets of the `auto-merge` environment, see [secrets.md](secrets.md). | auto (`workflow_run` of `🔀 Pull Request`: completed) | none |