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 access to secrets in GitHub Actions for PRs from third-party forks after approval #887

Open
ezekg opened this issue Sep 13, 2024 · 1 comment

Comments

@ezekg
Copy link
Member

ezekg commented Sep 13, 2024

Right now, when a PR is created from a third-party fork, our GitHub Actions secrets are not shared with the PR, which breaks the EE test suite (since EE requires a license file and license key). I want to adjust our CI workflow to allow third-party forks to have access to these secrets after the PR has been approved for a CI run. We don't allow Actions to run automatically for first-time contributors, so the risk of leaking secrets is low — and they're test secrets anyways, which will eventually expire.

image

If anybody has some knowledge here, I'd appreciate the help. I'd like to mirror what other open source projects do. This issue currently makes reviewing PRs a chore, since I have to run CI locally, which takes ~45 mins to run the full test suite.

Related: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/

@dreamorosi
Copy link

Hi @ezekg, we have a similar situation in our project for e2e tests.

In my project I created a workflow that I manually trigger when I want to run the tests, and that takes the PR number as an input.

In the action, I use the PR number to check out the fork from the contributor. At this point since I’m the actor having triggered the workflow, the action has access to all the secrets I have.

In our case we wanted to have the workflow run exclusively after the maintainer took action, so we kept it as a manual trigger.

What I do when reviewing a PR is usually take a look at the contribution, if it looks benign, then go manually trigger the workflow and have it run in the background while I continue the review.

If you wanted to skip a couple of clicks/pages, you could hook the trigger to either a label that you apply to the PR or a comment that you leave, and then use that event to do the same I described.

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

No branches or pull requests

2 participants