Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Set minimal workflow token permissions#2773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rtobar merged 4 commits intopython:3.12frompnacht:token-permissions
Dec 12, 2023

Conversation

pnacht
Copy link
Contributor

Fixes#2772.

This PR sets top-level read-only permissions on all CI/CD workflows. Jobs that require additional permissions (stale.yml andpr-comment.yml) are given them at the job-level.

I made more significant changes inpr-comment.yml. It is vulnerable to code injection, since it runs files controlled by the PR author (requirements.txt andscripts/list_missing_entries.py, taken from the PR). I have therefore modified the workflow to checkout those files from the base branch instead, ensuring we're running trusted versions of those files.

And in order to minimize the code that has access to theissues/pull-requests: write permissions, I have separated the workflow into two sequential jobs:

  1. define-comment, which is unprivileged and does almost everything
  2. write-comment, which has those additional permissions and uses them to perform the very last step of actually writing the comment on the PR.

Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
Copy link
Collaborator

@mmmarcosmmmarcos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. Thanks for this PR!

Copy link
Collaborator

@rtobarrtobar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the changes@pnacht, they seem very useful and I'll probably apply this to other projects I maintain.

I left a very small question, but otherwise LGTM. I'd also like to chase that pipeline failure before merging -- it seems unrelated, but since your changes touch exactly this infrastructure I'd like to get all tests passing correctly and make surr nothing really breaks.

@pnacht
Copy link
ContributorAuthor

pnacht commentedDec 11, 2023
edited
Loading

I'd also like to chase that pipeline failure before merging -- it seems unrelated, but since your changes touch exactly this infrastructure I'd like to get all tests passing correctly and make surr nothing really breaks.

Yeah, I'm pretty sure this is unrelated, but I've just pushed a commit that undoes the change to main.yml. Feel free to approve the workflow to test this again. If it still fails, I'll re-apply the read-only token permissions).


EDIT: Nevermind, I've unpushed that commit. Instead, please seethis PR on my fork. The test is failing even though the workflow workflow is unchanged on my main branch (3.12).

@rtobar
Copy link
Collaborator

@pnacht the issue with the CI failure is totally on our end, you just happened to be the first one to get hit by it. Hopefully we'll get#2776 merged soon to get it fixed.

mmmarcos reacted with thumbs up emoji

@rtobarrtobar merged commitd88bff3 intopython:3.12Dec 12, 2023
@rtobar
Copy link
Collaborator

Thanks again@pnacht for the changes!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rtobarrtobarrtobar left review comments

@mmmarcosmmmarcosmmmarcos approved these changes

@cmaureircmaureirAwaiting requested review from cmaureir

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Set minimal workflow permissions
3 participants
@pnacht@rtobar@mmmarcos

[8]ページ先頭

©2009-2025 Movatter.jp