Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torchi: Remove unprivileged access to ciflow #6324

Closed
wants to merge 2 commits into from

Conversation

seemethere
Copy link
Member

Removes the ability for users who are unprivileged to apply ciflow labels to PRs. This is a potential security risk since it allows for the following workflow:

  • Users submits benign PR
  • Maintainer approves workflows to be run
  • User modifies PR to include malicious code in workflows triggered by ciflow
  • User uses @pytorchbot label ciflow/<bleh> to apply ciflow labels

Removes the ability for users who are unprivileged to apply ciflow
labels to PRs. This is a potential security risk since it allows for the
following workflow:

* Users submits benign PR
* Maintainer approves workflows to be run
* User modifies PR to include malicious code in workflows triggered by
  ciflow
* User uses `@pytorchbot label ciflow/<bleh>` to apply ciflow labels

Signed-off-by: Eli Uriegas <eliuriegas@meta.com>
@seemethere seemethere requested a review from ZainRizvi February 24, 2025 18:57
Copy link

vercel bot commented Feb 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
torchci ✅ Ready (Inspect) Visit Preview Feb 24, 2025 7:01pm

@seemethere seemethere requested a review from wdvr February 24, 2025 18:57
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 24, 2025
Signed-off-by: Eli Uriegas <eliuriegas@meta.com>
Copy link
Contributor

@atalman atalman left a comment

Choose a reason for hiding this comment

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

lgtm

@huydhn
Copy link
Contributor

huydhn commented Feb 24, 2025

IMO, we could consider removing @pytorchbot label altogether after this. This mechanism is built to allow people without write permission to add ciflow label, which turns out to be a loophole that folks can exploit. If you already have write access, it's easier to just add the label directly into the PR.

@ZainRizvi
Copy link
Contributor

ZainRizvi commented Feb 24, 2025

IMO, we could consider removing @pytorchbot label altogether after this. This mechanism is built to allow people without write permission to add ciflow label, which turns out to be a loophole that folks can exploit. If you already have write access, it's easier to just add the label directly into the PR.

@huydhn we still have other classes of labels like "topic: ..." and "release notes:...". Edit: They are used regularly (example)

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

IMO it does not solve the underlying if user pushes malitious change after someone adds ciflow/ label. Bot should not create tags if workflows are not approved

@huydhn
Copy link
Contributor

huydhn commented Feb 24, 2025

@huydhn we still have other classes of labels like "topic: ..." and "release notes:...". Actually, do people manually add those using pytorchbot...?

Good point, there might be folks without write permission trying to add these labels, but it's probably rare because these labels are mostly added automatically or added by the reviewer. Given the issue today, it makes sense to reduce the attack surface by removing @pytorchbot label. But that's up to discussion.

@ZainRizvi
Copy link
Contributor

@huydhn we still have other classes of labels like "topic: ..." and "release notes:...". Actually, do people manually add those using pytorchbot...?

Good point, there might be folks without write permission trying to add these labels, but it's probably rare because these labels are mostly added automatically or added by the reviewer. Given the issue today, it makes sense to reduce the attack surface by removing @pytorchbot label. But that's up to discussion.

As per clickhouse, in the past 4 weeks these labels were added 140 times by folks who's author_association was not MEMBER (204 if you include MEMBER)

@huydhn
Copy link
Contributor

huydhn commented Feb 24, 2025

Hmm, there is also keep-going which has legit use. So, it seem that we won't be able to remove @pytorchbot label then.

@zxiiro
Copy link
Collaborator

zxiiro commented Feb 24, 2025

@huydhn we still have other classes of labels like "topic: ..." and "release notes:...". Actually, do people manually add those using pytorchbot...?

Good point, there might be folks without write permission trying to add these labels, but it's probably rare because these labels are mostly added automatically or added by the reviewer. Given the issue today, it makes sense to reduce the attack surface by removing @pytorchbot label. But that's up to discussion.

As per clickhouse, in the past 4 weeks these labels were added 140 times by folks who's author_association was not MEMBER (204 if you include MEMBER)

For my understanding, I think MEMBER is someone who has explicitly been added to either the GitHub org or the repo with some level of permissions. Do regular contributors eventually become MEMBERs?

(I can't imagine very many drive by contributors will even know the ciflow labels exist.)

@seemethere seemethere closed this Feb 25, 2025
@seemethere
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants