nf-core / nf-core/tools

Reduce privileged-token exposure in fix_linting.yml

Open
#4,471 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
322
Forks
255
Avg merge
2d 3h
Merged PRs (30d)
5

Description

The @nf-core-bot fix linting workflow in the pipeline template checks out a pull request with gh pr checkout and then runs prek (which executes hook configuration from that same pull request) while the privileged nf_core_bot_auth_token is already present in the job's git credential store from the initial checkout step. Since prek's hook config is part of the untrusted PR content, that job ends up running PR-controlled tooling in the same context as a write-scoped token.

This is routine GitHub Actions hygiene to tighten — the general pattern (separating the job that runs untrusted PR code from the job that holds a privileged token) is the same approach already used for the PR-comment workflows (#4342). I've put together a PR that applies it here too, tested by rendering the template and running actionlint against the output.

While in there, I also tightened awsfulltest.yml's "second approval" trigger, which currently trusts github.event.review.state == 'approved' without checking that the approving reviewer actually holds write access — anyone can leave an "Approved" review on a public repo, so this should verify permission level via the API rather than trusting the review state alone.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pipeline template's fix_linting.yml workflow and inspect awsfulltest.yml's second-approval trigger. Render the template and run actionlint as described; done means untrusted pull-request hooks no longer share the privileged token context and approval handling verifies reviewer write access.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.