Skip to content

fix(ci): add explicit least-privilege permissions default - #590

Merged
BitHighlander merged 1 commit into
alphafrom
fix/round5-ci-least-privilege-token
Aug 25, 2026
Merged

fix(ci): add explicit least-privilege permissions default#590
BitHighlander merged 1 commit into
alphafrom
fix/round5-ci-least-privilege-token

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Problem

ci.yml declared no top-level permissions: block. Every job -- including
ones that only checkout, build, and run tests -- inherited whatever the
repository's default GITHUB_TOKEN scope was, with no explicit floor
declared in the workflow itself. This is the second half of #424 (the
first half, an unverified gitleaks binary install, was fixed by #589).

Fix

Add a workflow-level permissions: contents: read default. Job-level
permissions: blocks always take precedence over the workflow default in
GitHub Actions, so publish-emulator-libs (the only job that needs
contents: write, for its gh release create/gh release upload calls)
keeps working unchanged -- it already declares its own override.

Verification

  • Confirmed every other job (lint-format, secret-scan, static-analysis,
    check-submodules, crypto-tests, build-emulator, build-arm-firmware,
    unit-tests, python-integration-tests, python-dylib-tests,
    generate-test-report, ci-gate, publish-emulator) only does
    checkout/build/test/artifact-upload/artifact-download or, for
    publish-emulator, a DockerHub login via secrets (not GITHUB_TOKEN) --
    none require anything beyond contents: read.
  • YAML validated with python3 -c "import yaml; yaml.safe_load(...)".

Second half of #424.

ci.yml declared no top-level `permissions:` block, so every job -- including
ones that just checkout, build, and run tests -- inherited whatever the
repo default GITHUB_TOKEN scope was, with no explicit floor. Only
publish-emulator-libs actually needs write access (gh release create/upload),
and it already declares its own contents:write override, which continues to
take precedence over this default.

Second half of #424 (the first half, unverified gitleaks install, was fixed
by #589).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant