Skip to content

Enhance security: Restrict automated PR workflows to offi...#56

Closed
bigweaverbeta[bot] wants to merge 1 commit into
mainfrom
BigWeaver-Demo-Branch-1757619576
Closed

Enhance security: Restrict automated PR workflows to offi...#56
bigweaverbeta[bot] wants to merge 1 commit into
mainfrom
BigWeaver-Demo-Branch-1757619576

Conversation

@bigweaverbeta
Copy link
Copy Markdown

@bigweaverbeta bigweaverbeta Bot commented Sep 11, 2025

Description

This PR adds safety checks to automated workflow files that create pull requests, ensuring they only run on the official model-checking/kani repository 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:

  1. Job-level conditional check: if: github.repository == 'model-checking/kani'
  2. Explicit repository verification step that double-checks the repository identity
  3. Additional conditional check before PR creation steps

These changes were applied to:

  • .github/workflows/cargo-update.yml
  • .github/workflows/cbmc-update.yml
  • .github/workflows/toolchain-upgrade.yml

Also added a validation script tests/script-based-pre/check_workflow_fork_safety.sh that 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.

@tautschnig tautschnig closed this Sep 12, 2025
@tautschnig tautschnig deleted the BigWeaver-Demo-Branch-1757619576 branch September 12, 2025 08:30
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.

1 participant