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

Fix check-labels workflow commenting on forked PRs #101467

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-labels.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Check Labels

on:
pull_request:
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
Copy link
Contributor

@malfet malfet May 15, 2023

Choose a reason for hiding this comment

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

Let's limit pull_request_target trigger only to PRs that target main branch. And perhaps, to be extra paranoid: only PRs that do not modify any of the .yml files

Suggested change
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches-ignore: [main]
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches: [main]

Copy link
Member Author

Choose a reason for hiding this comment

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

For something bad to happen with non-main branch, the attacker needs to have write permissions to the repo.
And with the write permissions, anything can be changes.
But I'm fine with this change if it feels safer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed offline, will do the suggested way.

workflow_dispatch:

Expand Down