Repository navigation
ci(workflows): read-only default token and a same-repo check on the registry publish - #100
Merged
Merged
Conversation
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.
Closes the CodeQL
actions/missing-workflow-permissionsalerts #1, #2, #3, #4, #5.ci.yml,scheduled-lint.ymlhad nopermissions:block, so every job without its own block ran with the default token. Each now starts with a top-levelpermissions: contents: read. The existing job-level blocks are untouched and still replace it for their own job. I went through every job that has no block of its own: they check out, install and run, and none comments, pushes, releases or calls the API. The org default token is already read-only, so the runs behave the same; the block makes it explicit per workflow.scheduled-lint.ymlalso had a real bug: the steps run underbash -e, so a failingpre-commitorpymarkdownlntended the step beforeEXIT_CODE=$?ran. The status and output were never written and the log showed nothing, because the output went to a file. The exit code is now kept with|| EXIT_CODE=$?, the captured output is printed, and$GITHUB_OUTPUTis quoted and written once (shellcheck SC2086, SC2129).Closes the CodeQL
actions/untrusted-checkout/highalert #6 onregistry-publish.yml. Onworkflow_runthe job checks outworkflow_run.head_shaand runs it withid-token: write. The upstream "Publish to PyPI" workflow only runs onreleaseandworkflow_dispatchtoday, but nothing in this workflow enforced that. The job now also requiresworkflow_run.head_repository.full_name == github.repositoryand a triggering event ofreleaseorworkflow_dispatch, so a run started from a fork or from another event can never reach the checkout. Manual dispatch is unchanged.Checked:
actionlintpasses on every changed workflow. The CodeQL run on this PR is the check that the alerts close.