ci: add top-level permissions: contents: read for least-privilege security#155
ci: add top-level permissions: contents: read for least-privilege security#155abhi-14gyan wants to merge 1 commit intom-lab:mainfrom
Conversation
|
@abhi-14gyan This is a good idea, thank you. I think we did not follow this practice quite consistently here and in other codebases. My understanding is that, depending on the age of the organization, different defaults are applied and so the impact varies by organization. Does that mirror your understanding as well? |
|
@bassosimone Yes, that mirrors my understanding exactly. GitHub has changed the default
|
|
After listing our project for GSoC, we received a large amount of pull requests across several repositories. We are dealing with the backlog, but this would take time. We will get back to this pull request eventually. In the meanwhile, if you are a GSoC applicant, please read our updated GSoC policy: https://github.com/m-lab/gsoc/. |
Description
Add a top-level
permissions: contents: readblock to the CI workflow (.github/workflows/ci.yml). Without this, all jobs inherit the defaultGITHUB_TOKENpermissions — which onpushevents includes write access to contents, packages, deployments, etc. This change restricts the token to read-only by default, following the GitHub-recommended least-privilege principle.Jobs affected (all gain explicit read-only restriction):
test-qualityactions/checkout+ ruff + pyrighttest-allactions/checkout+ pytest + Codecov uploadtest-prototype-integrationactions/checkout+ Streamlit smoke testtest-dockeractions/checkout+ Docker build + runRelated Issue
Closes #154
Type of Change
Component(s) Affected
library/)prototype/)data/)analysis/)docs/).github/)How Has This Been Tested?
test-quality,test-all,test-prototype-integration,test-docker) only require read access, so no regressions expected.Checklist
uv run ruff check).uv run pytest).