Skip to content

Security hardening (tasks collection) #5

Open

Description

@aldbr

On 11 Nov a stolen developer token pushed a branch into five of our repositories, ran a workflow from it and read every secret that workflow could see. This issue tracks what we changed since, and what is left, in priority order. It is also the agenda for the review meeting.

Rule from now on: no new hardening PR unless it serves an open item below.

1. What is already in place

Organization

  • Two-factor authentication required for all members.
  • Actions policy: only GitHub's actions, our own, and an explicit list are allowed; every action must be pinned to a full commit SHA; fork PR workflows need approval.
  • A security configuration (secret scanning, push protection, Dependabot alerts) is enforced on all public repositories and is the default for new ones.
  • Only organization owners can delete or transfer a repository or change its visibility.
  • Classic personal access tokens are blocked for the organization; fine-grained ones need approval (26 Nov). The credential stolen on 11 Nov was an OAuth token of the GitHub CLI, which this policy does not cover: what limits such a token is the rest of this list (no branch creation, environments, approvals).

Access

  • dirac-developer has the triage role (assign, label; no push) on the DiracX repositories, as on the others. Pushing is limited to release managers.
  • The bot account is out of the admin team, and its tokens are revoked except those the conda-forge environment of DIRAC still uses.
  • GitHub Actions cannot approve pull requests on the 16 repositories without release-please.

Repositories (rulesets)

  • branches: protected branches change only through a pull request with one approval and signed (verified) commits; no force push, no deletion.
  • fork-only: nobody creates branches in the repositories, pull requests come from forks. Renovate is the exception.
  • tags: only release managers create tags (or nobody, where there are no releases).
  • required-checks on 9 repositories: pre-commit (and a few stable jobs) must pass, and only results reported by GitHub Actions count.
  • The approval must come from someone other than the last person who pushed. A code owner must approve where a CODEOWNERS file exists: every repository with workflows has one for .github/, owned by the release managers (DIRAC keeps its own file and is exempt).
  • The rulesets are defined once, in rulesets/ of this repository, and applied with scripts/rulesets.py (applied on 23 and 24 Nov; all 20 repositories match the templates). To change a rule, change it there, then run apply.

Workflows

  • The workflow token is read-only by default; each workflow declares the permissions it needs.
  • Every action is pinned to a commit SHA; zizmor checks the workflows in pre-commit.
  • pre-commit runs directly in the workflows (pip install pre-commit==4.7.0), not through pre-commit/action: that action calls actions/cache by tag, which the SHA-pinning policy rejects. Renovate keeps the pinned version current.
  • Removed: the labeler and sweep workflows, the draft-PR workflows, the commit message check workflows, Docker Hub pushes, the pre-commit.ci apps (the lite one included; pre-commit fails and prints the diff instead).
  • Cleaned up: dead and unknown webhooks, the unused copilot and charts environments, 89 old branches (only branches with an open pull request remain besides the protected ones).

Secrets and publishing

  • Removed: NPM_TOKEN, DRAFT_PAT, CHARTS_UPDATE_TOKEN, the release-please tokens of intercede and signurlarity, DIRAC PAT, DIRACOS2 GH_TOKEN.
  • PyPI and npm publishing use trusted publishers (short-lived OIDC tokens) from an environment that requires a release manager's approval.
  • DIRAC: environments cvmfs and conda-forge are limited to release branches and tags, with approval. The CVMFS upload runs in its environment, which now holds the proxy; no repository in the organization has a repository-level secret left except the Mattermost webhook of .github. The tmate step is gone.
  • Trivy scan of the diracx images reports only fixable critical and high findings (ci: report only fixable critical and high findings from Trivy diracx#1211).
  • Release pattern (CI drafts, a release manager publishes, CI ships after a second approval): in use. Released with it on 24-25 Nov: signurlarity 0.3.2, intercede 0.1.1, DIRAC 9.1.25 and 9.0.31, WebAppDIRAC 6.0.10 and 5.0.16, diracx-web 0.1.0-a12 (npm: staged by CI, approved by a maintainer on npm). DB12 and diraccfg already publish from a tag.
  • Private vulnerability reporting and immutable releases are on for the repositories that release.
  • Tests are required, by one stable job name, on DIRAC (basic-ok, three branches), DIRACOS2, diracx-charts and Pilot (ci-ok); applied 26 Nov. WebAppDIRAC requires pre-commit and pyLint.
  • The release-please branch exemption of fork-only names one branch per repository, no longer a pattern (chore: limit the release-please exception to the one branch it uses #27).
  • Codecov is gone from diracx, the only repository that used it (chore: remove codecov diracx#1219).

Dependencies

Merged pull requests (196), by theme

2. Broken right now

3. Open work, by priority

P0. Close the path that was used

  • diracx: ci: use GITHUB_TOKEN for release-please and publish with the pypi environment diracx#1187 (release-please without a stored token, PyPI through the pypi environment; the diracx.env example now lives in the repository). Checks pass. Waiting for an approval: fstagni is the author and aldbr pushed last, so either another release manager approves, or fstagni pushes a real change (an empty commit does not count) and aldbr approves. With it: set the 10 PyPI publishers to require the environment. MY_RELEASE_PLEASE_TOKEN is deleted (24 Nov).

P1. Make the rulesets uniform and meaningful

  • Required checks beyond pre-commit: first batch done (section 1); open pull requests in those repositories must be updated from their base branch. Left: the DIRAC integration tests (skipped on docs-only changes), and the second batch (diracx, diracx-web, signurlarity, intercede, DB12, diraccfg).
  • feat: automerge non-major Renovate updates #12 (Renovate automerge of non-major updates): wanted, release branches included. It does not depend on the item above: Renovate itself waits for all the checks of the pull request, required or not. Left: review and merge.

P2. Release without stored credentials, and prove it

Pattern (decided 20 Nov): CI drafts, a release manager publishes, CI ships. A workflow creates a draft release; a release manager publishes it, which creates the tag; on: release: published builds and publishes through the approved environment. No workflow stores a credential that can push to a protected branch or create a tag. Background: PyPI trusted publishers, rulesets, immutable releases.

Tick only after a real release:

  • diracx: ci: use GITHUB_TOKEN for release-please and publish with the pypi environment diracx#1187
  • DIRAC: 9.1.25 and 9.0.31 released with the pattern (25 Nov): PyPI and CVMFS done.
  • DIRAC, conda-forge step: it creates the feedstock pull request, then fails when labelling it (a bug of the pinned conda-forge/release action, fixed upstream but not tagged; it has ended every release this way since October). For 9.1.25: label or merge feedstock PR 222 by hand. Then ask upstream for a tag and bump the pin.
  • WebAppDIRAC: 6.0.10 and 5.0.16 released with the pattern (25 Nov).
  • DIRACOS2: the release script already drafts, uploads the installers, then publishes and pushes a version bump to main. To do: stop at the draft, and replace the pushed version bump (refused by the ruleset), for example by computing the next version from the latest release. To agree with the DIRACOS2 maintainers; no PR yet
  • intercede: 0.1.1 released with the pattern (25 Nov).
  • diracx-web: 0.1.0-a12 released with the pattern (25 Nov): npm package and release image done.
  • DB12, diraccfg: already tag → build → publish
  • diracx-charts: no chart has been published since 1.1.20 (12 Nov): the chart releaser cannot create tags or push gh-pages. Decided 26 Nov: publish the chart to ghcr.io as an OCI package (oci://ghcr.io/diracgrid/diracx-charts), which needs neither. ci: publish chart oci diracx-charts#348 (in review; includes a one-off copy of the versions already published, and the install pages), documentation in docs: the chart is published to ghcr.io, extensions follow it with Renovate diracx#1223 (draft, to merge after). Then: make the package public and limit its write access to the repository's workflows; run the copy once; change the repository: line in lhcbdiracx-charts and gubbins, and the chart check of lhcbdiracx; delete the four stuck drafts; remove the chart releaser from the allowed actions.

Also:

P3. Protect the protections

  • Eight accounts (the dirac-release-manager team) are admin on every repository and can edit any ruleset. Closed by the teams item below (admin for the organization owners only). A scheduled drift report is then optional.
  • Teams and roles: proposal under discussion (admin for the organization owners only; maintainer teams with write per project; dirac-release-manager reduced to the people who release, used for the tag bypass, the environment approvals and CODEOWNERS). Apply it after P0: more people with write means more tokens that can merge.
  • Release branch exception: on diracx, diracx-web, intercede and signurlarity the fork-only ruleset lets anyone with write push the release-please branch, because the workflow token cannot be given a bypass. A workflow on that branch is not limited to what main runs. Harmless while only the admins have write; to settle before the teams item gives write to more people. Since 26 Nov the exemption names only the one branch release-please uses (chore: limit the release-please exception to the one branch it uses #27, applied). Then choose: replace release-please by a draft made on demand where the version comes from the tag, or accept it and add a scheduled report of pushes to that branch by anyone but the workflow.

P4. Housekeeping

4. Decisions

Taken on 23 Nov:

  • pre-commit runs directly in the workflows.
  • diracx.env is an example committed in the diracx repository.
  • The ruleset templates are merged and applied.

Taken on 24 Nov:

Taken on 26 Nov:

  • Charts are published to ghcr.io on every merge to master of diracx-charts, with no release manager: a deliberate exception to "CI drafts, a release manager publishes", because that repository releases on almost every merge (ci: publish chart oci diracx-charts#348).
  • Classic personal access tokens are blocked.

Still to take:

  1. Automerge (feat: automerge non-major Renovate updates #12): wanted, on all repositories and branches.
  2. Admin rights and teams: the layout in P3.

Activity

  1. changed the title [-]On minimizing our dependencies to user tokens[/-] [+]On minimizing our dependencies to secrets[/+] on Nov 11, 2026
  2. changed the title [-]On minimizing our dependencies to secrets[/-] [+]Security hardening (tasks collection)[/+] on Nov 12, 2026
  3. transferred this issue fromDIRACGrid/diracxon Nov 12, 2026
  4. fstagni commented on Nov 17, 2026

    @fstagni
    Contributor

    Status update on the failing PRs (all diagnosed, fixes pushed where needed):

    New PRs opened:

    Fixes pushed to existing PRs:

    • DIRAC#8900: two root causes found and fixed (8e7ab5b6):
      • pixi.lock was still in .gitignore → never committed → prefix-dev/setup-pixi failed with Failed to generate cache key on all check/check-py314 jobs (and the environments weren't actually locked). Lockfile now generated and committed.
      • the integration workflow quoted $MATRIX_ARGS, merging all KEY=VALUE pairs of matrix.ARGS into a single argument (MYSQL_VER="mariadb:11.4.3 ES_VER=..." → invalid docker reference; backward-compat job got a mangled INSTALLATION_BRANCH). Word-splitting restored.
    • DIRAC#8893 (rel-v8r0 zizmor): merged upstream/rel-v8r0 to resolve the conflict — the only conflict was the pylint-py27 job, dropped in favor of the upstream removal (#8895). Now MERGEABLE again.

    Diagnosed as not caused by the PRs — re-runs triggered:

    • DIRACOS2#210/#211: pre-existing on the bases. Root cause was conda-forge shipping cachetools 8.0.0, which broke DIRAC v9 auth (Registry caches) — fixed upstream by DIRAC#8902, now on integration/rel-v9r0. The failed jobs have been re-run.
    • diracx#1189: pre-existing infra flake on main (cert-manager webhook not ready when issuer.yml is applied → diracx/dex pods never healthy → Connection refused in cli_env). main is green again; failed jobs re-run.
    • diracx-web#521: pre-existing on main since Nov 16 — same cert-manager demo bootstrap failure (secrets "root-secret" not found, webhook connection refused/x509) plus ghcr.io/gubbins/tasks:dev anonymous-pull 403 in the gubbins run. Needs a separate infra issue for the diracx demo/chart maintainers; a plain re-run of #521 will likely fail until that's fixed.

    Still open (unchanged): the zizmor PRs awaiting review, exclude-newer rollout (intercede, signurlarity, diracx-charts, diracx-web), the pixi lockfile-maintenance rule in the shared Renovate preset, and the diraccfg zizmor PR (now stacked on #13 → #15).

  5. 22 remaining items

  6. added a commit that references this issue on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions