Skip to content

Pin the token to read-only in the pytest workflow - #165

Open
mawad-amd wants to merge 3 commits into
mainfrom
muhaawad/pin-pytest-token-permissions
Open

mawad-amd wants to merge 3 commits into
mainfrom
muhaawad/pin-pytest-token-permissions

Conversation

@mawad-amd

Copy link
Copy Markdown
Member

The two GPU workflows disagree about what they hand their jobs:

workflow permissions: effective token
intellikit-ci-test.yml contents: read read-only
intellikit-pytest.yml none repo default — write

They do the same kind of work, so this makes intellikit-pytest.yml match.

Why it is safe

intellikit-pytest.yml checks out the repo and builds an Apptainer image locally. No docker/login, no registry, no secrets.*, no upload-artifact — nothing that writes back to GitHub. The packages: line is a job output name, not a permission. And intellikit-ci-test.yml already runs the same container_build.sh under contents: read, so the configuration is proven by its sibling rather than by argument.

What it does not do

It does not change fork-PR behaviour. GitHub already forces a read-only token and withholds secrets for pull_request from a fork, regardless of default_workflow_permissions. This closes the gap for pushes and same-repo pull requests, where the repository default does apply.

Found while reviewing the self-hosted runner exposure. Worth having independently of that.

mawad-amd and others added 3 commits August 24, 2026 12:52
intellikit-ci-test.yml declares permissions: contents: read;
intellikit-pytest.yml declares nothing and so inherits the repository
default, which is write. The two workflows do the same kind of work and
should not differ in what they hand their jobs.

Safe for this workflow: it checks out the repo and builds an Apptainer
image locally. No registry login, no secrets, no artifact upload,
nothing that writes back to GitHub. The `packages:` line is a job output
name, not a permission. ci-test.yml already runs the same container
build under contents: read.

This does not change fork-PR behaviour -- GitHub already forces a
read-only token and withholds secrets for pull_request from a fork
regardless of the repository default. It closes the gap for pushes and
same-repo pull requests, where the default does apply.

Co-Authored-By: Claude <noreply@anthropic.com>
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