Do not checkout the fork's branch upon history comparison#23
Merged
Conversation
This is the layer step for using the pull_request_target event as trigger The purpose is to not allow anyone to tamper with our CI, so we need to be in our repo's context
8e7f15c to
7936659
Compare
This also adds colored logs to make sure people's attention is redirected to the error easily
7936659 to
9904284
Compare
ChrisLovering
approved these changes
Aug 23, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reasoning
Generally, when using the
pull_requestevent as trigger for our CI, it uses thefork's CI context, allowing malicious users to tamper with CI.We are switching to using
pull_request_targetas event, which ensures that CI is executed with our repo's context.The main condition to using this is to not checkout nor execute the
fork's code.Solution
The approach was to add the fork as remote, but we only make a
fetchoperation instead of acheckoutone, ensuring that we only have our code checked out.