Harden Forgejo CI: disable untrusted PR runs on self-hosted runner#40
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6367c31c53
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| branches: [main, dev, release/*, feature/*] | ||
| pull_request: | ||
| branches: [main, dev, release/*] | ||
| workflow_dispatch: |
There was a problem hiding this comment.
Restore a PR-capable trigger for fork contributions
For pull requests opened from forks, replacing pull_request with workflow_dispatch removes the only way to test the proposed commit on Forgejo before merge. A manual dispatch runs against a ref in the base repository, and the unchanged actions/checkout@v4 step later in this file uses its defaults, so it checks out github.repository at that base ref rather than the contributor's fork/head branch. In practice, forked PRs now get no Forgejo CI coverage unless a maintainer first copies the branch into this repository.
Useful? React with 👍 / 👎.
6367c31 to
8351a25
Compare
|
I do not think the Codex review identifies a correctness bug in this PR. It correctly notes that removing |
Motivation
pull_requestand executed repository-controlled build steps on the self-hostedrustrunner, allowing untrusted PRs to run arbitrary commands on the runner host, so the trigger must be removed to prevent RCE risk.Description
pull_requesttrigger withworkflow_dispatchin.forgejo/workflows/ci.ymlwhile keeping the existingpushtriggers and all job steps intact to preserve CI functionality for trusted pushes and manual runs.Testing
ruby -e "require 'yaml'; YAML.load_file('.forgejo/workflows/ci.yml')"which returned successfully;git diffshowed the change; and the change was committed successfully.Codex Task