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

Bypass actor validation for Image, Build, Test, Vul-Scan workflow triggered by forked PRs #253

Merged
merged 5 commits into from
Sep 27, 2024

Conversation

zhijie-yang
Copy link
Contributor

Ping the @canonical/rocks team.


Description

According to the GitHub documentation, secrets are not passed to the runner when a workflow is triggered from a forked repository. Therefore, for forked PR, the actor validation will always fail. To cope with this issue, we allow the bypassing of actor validation for the Image, Build-Rock, Tests and Vulnerability-Scan workflows triggered with a forked pull request.

More security thought: The external user's PR workflow will only run upon approval by the repo's maintainer, so the chance of exploiting is considered low. The external user's PR will neither trigger Upload and Release workflows nor have the secrets in the main repo, so the secrets are safe from stealing.

Related issues

Failed Image workflow run: https://github.com/canonical/oci-factory/actions/runs/11048142134/job/30691724573

Tests

  1. Actor validation is bypassed when a PR from a forked repo triggers the workflow. https://github.com/canonical/oci-factory/actions/runs/11069540851/job/30757337773?pr=252

@zhijie-yang zhijie-yang requested a review from a team as a code owner September 27, 2024 11:23
Copy link
Collaborator

@cjdcordeiro cjdcordeiro left a comment

Choose a reason for hiding this comment

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

What made you change the plan for disabling it all together for PRs? (given that contacts.yaml files are incomplete)

@zhijie-yang
Copy link
Contributor Author

The maintainers field of the contacts.yaml file should be properly inflated when the external contributor is onboarding the new image to the oci factory. In the forked PRs, the workflow after "Tests" won't be run by default. Once the new image is onboard, the contacts.yaml file should be ready, and the workflow should have green lights all the way through till the end.

@cjdcordeiro cjdcordeiro self-assigned this Sep 27, 2024
@cjdcordeiro cjdcordeiro merged commit 612d696 into main Sep 27, 2024
6 checks passed
@cjdcordeiro cjdcordeiro deleted the ROCKS-1548/bypass-pr-actor-validation branch September 27, 2024 13:41
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

Successfully merging this pull request may close these issues.

3 participants