fix(ci): add explicit least-privilege permissions default - #590
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ci.ymldeclared no top-levelpermissions:block. Every job -- includingones that only checkout, build, and run tests -- inherited whatever the
repository's default
GITHUB_TOKENscope was, with no explicit floordeclared 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: readdefault. Job-levelpermissions:blocks always take precedence over the workflow default inGitHub Actions, so
publish-emulator-libs(the only job that needscontents: write, for itsgh release create/gh release uploadcalls)keeps working unchanged -- it already declares its own override.
Verification
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.python3 -c "import yaml; yaml.safe_load(...)".Second half of #424.