Skip to content

secure CI for fork and trusted pull requests - #39

Open
erivaninan wants to merge 1 commit into
causalNLP:mainfrom
erivaninan:fix-pr-ci
Open

erivaninan wants to merge 1 commit into
causalNLP:mainfrom
erivaninan:fix-pr-ci

Conversation

@erivaninan

Copy link
Copy Markdown

This PR updates the test workflow to handle fork and trusted pull requests separately.

  • Fork pull requests run the test suite without repository secrets.
  • Same-repository pull requests and trusted events retain access to OPENAI_API_KEY through the protected causal-agent environment.
  • The workflow now uses pull_request instead of pull_request_target.
  • actions/checkout is updated from v3 to v4.
  • The workflow token is explicitly restricted to read-only repository access.

The previous workflow used pull_request_target, checked out code from a fork, and executed it with access to repository secrets. GitHub now blocks this pattern because it can lead to a "pwn request" vulnerability.

The new workflow preserves regular unit testing for fork contributions while keeping API-backed tests available only in trusted contexts. (This PR should be merged before PR#36 so that its pytest workflow can run safely.)

This branch has not been deployed

No deployments
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