Enhance security: Restrict automated PR workflows to offi...#56
Closed
bigweaverbeta[bot] wants to merge 1 commit into
Closed
Enhance security: Restrict automated PR workflows to offi...#56bigweaverbeta[bot] wants to merge 1 commit into
bigweaverbeta[bot] wants to merge 1 commit into
Conversation
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.
Description
This PR adds safety checks to automated workflow files that create pull requests, ensuring they only run on the official
model-checking/kanirepository and not on forks. This prevents unwanted PR creation in forked repositories.Problem
Without proper repository checks, automated workflows that create pull requests would also run on forked repositories, potentially creating unwanted PRs against the forks. This is undesirable behavior and could cause confusion for contributors.
Solution
Added three layers of protection to each workflow file:
if: github.repository == 'model-checking/kani'These changes were applied to:
.github/workflows/cargo-update.yml.github/workflows/cbmc-update.yml.github/workflows/toolchain-upgrade.ymlAlso added a validation script
tests/script-based-pre/check_workflow_fork_safety.shthat ensures these safety checks are present in all workflow files that create PRs, helping prevent regressions in the future.Testing
Manually verified that all three workflow files have the required safety checks in place. The added validation script will ensure these checks remain in place over time.
Resolves #ISSUE-NUMBER
License
I confirm that this contribution is made under the terms of the Apache 2.0 license and the MIT license.