Harden GitHub Actions before making the repository public

Aperta
#1,360 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, github-actions, shell
Ambito
ci-cd, devops, security

Direzione di ricerca

This is a tracking issue, not a code change: it depends on sub-issues #1357 and #1359, on #1346 removing .github/workflows/build.yml, and on repository/org admin access that a first-time contributor will not have. Start by reading the sub-issues and the credential-bearing workflows (bug-bash-identity.yml) to see which runners and environments are in scope, then record runner inventory with gh api per the acceptance criteria. Done means every unchecked box plus the acceptance criteria are verified and recorded in the thread.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

act-platform-engineering-squad

Summary

Once the repository is public, anyone can fork it and open a pull request, and GitHub Actions will run workflows from that PR. Any self-hosted runner, credential, or setting reachable from those workflows becomes reachable by untrusted code. This issue tracks the GitHub Actions hardening that must be complete before the visibility change.

Workflow-file conditions (for example "skip if fork") are not a security boundary: for pull_request events the workflow definition comes from the PR itself, so a fork can remove them or add a new workflow. Protection must come from repository, runner, and environment settings; YAML conditions are defense in depth only.

Sub-tasks

  • #1357 — Live recording: move the credentialed recording refresh off the live-recorder self-hosted runner (includes the interim step of disabling/restricting that runner before going public).
  • #1359 — Benchmarks: stop fork PRs from running on the 1ES self-hosted benchmark pool.
  • #1364 — ADO alpha pipeline: tighten fork PR settings on azclips-alpha-build before inviting fork PRs.

Repository settings (admin, before going public)

  • Fork PR approval: set Settings → Actions → General → Approval for running fork pull request workflows from contributors to Require approval for all external contributors. The default only requires approval for first-time contributors, so anyone who has previously had a commit or PR merged can run workflows without approval.
  • Runner inventory: list all self-hosted runners and runner groups available to this repository (repo and org level) and confirm none with credentials, managed identities, or corporate network access is usable by public workflows beyond what #1357 and #1359 cover.
  • Credentialed environments: for environments used by OIDC/live workflows (e.g. bug-bash-identity, referenced by bug-bash-identity.yml and created by its bootstrap script), when they are created restrict deployment branches to main, add required reviewers where appropriate, and confirm the federated credential subject is scoped to that environment.
  • Default token permissions: confirm the default GITHUB_TOKEN permission is read-only and workflows request write scopes explicitly.

Obsolete secrets and variables (after #1346 merges)

#1346 removes .github/workflows/build.yml, the only user of the PFX signing secrets. Release signing goes through ESRP in Azure Pipelines.

Name Kind Status
BASE64_ENCODED_PFX, PFX_KEY repository secrets Only used by build.yml
STORAGE_CREDENTIALS repository secret Not referenced by any workflow on main
CIRRUS_WEB_STORAGE, RESOURCE_GROUP repository variables Not referenced by any workflow on main
  • Confirm no workflow on an active branch references these names, then delete them:
    gh secret delete BASE64_ENCODED_PFX -R Azure/azclips
    gh secret delete PFX_KEY -R Azure/azclips
    gh secret delete STORAGE_CREDENTIALS -R Azure/azclips
    gh variable delete CIRRUS_WEB_STORAGE -R Azure/azclips
    gh variable delete RESOURCE_GROUP -R Azure/azclips
    
  • If the PFX was a real (non-self-signed) code-signing certificate, have its owner revoke or rotate it.
  • Identify what STORAGE_CREDENTIALS granted access to and revoke/rotate that credential.

Before inviting fork PRs

  • Enforce code owner review for CI and release paths: #1342 added owners for /.github/, /.azure-pipelines/, and /devops/, but the main ruleset still has Require review from Code Owners off, so a fork PR changing those paths needs only one approval from any writer, and once merged that code runs in trusted signing/release pipelines. Enable Require review from Code Owners, and add owners for /install/ and /build/ (install scripts and release/doc-sync scripts), which are still uncovered. (The empty .github/workflows/CODEOWNERS is not read by GitHub at that path and can be removed.) Done: owners for /build/ and /install/ added in #1365; code owner review is enforced by classic branch protection on main (the rulesets show it off) — evidence.

After going public

  • Enable secret scanning and push protection; confirm Dependabot alerts and branch protection on main.

Acceptance criteria

  • #1357 (at least its interim runner step) and #1359 are done.
  • Repository settings above are verified by an admin and recorded here (screenshots or gh api output).
  • No self-hosted runner with credentials or internal network access is usable by a workflow from a fork PR.
  • Before inviting fork PRs: code owner review is enforced for CI/release paths.
  • gh secret list / gh variable list contain only names referenced by current workflows.
Lingua principale
C#
Stelle
18
Fork
10
Merge medio
1g 20h
PR unite (30g)
157

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azclips

Tutte le issue di Azure/azclips

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.