Skip to content

Add fork-safe PR workflow and permissions#73

Open
bschwedler wants to merge 9 commits intomainfrom
ci/fork-safe-pr
Open

Add fork-safe PR workflow and permissions#73
bschwedler wants to merge 9 commits intomainfrom
ci/fork-safe-pr

Conversation

@bschwedler
Copy link
Copy Markdown
Contributor

Summary

  • Add pr.yml calling bakery-build-pr.yml@main for fork-safe PR builds (production, development, session)
  • Remove pull_request trigger from existing build workflows (handled by pr.yml)
  • Fix session.yml cron mismatch ('15 3 * * 0' condition vs '15 4 * * 0' cron)
  • Add permissions: {} at workflow level + per-job declarations

Part of rstudio/platform-team#435.

Test plan

  • pr.yml runs on this PR
  • Existing build workflows do not trigger on PRs
  • Push-to-main and schedule triggers still work after merge
  • Session builds trigger correctly on the weekly schedule

Dedicated PR workflow that calls bakery-build-pr.yml, which
is safe for fork PRs (no secrets required). Consolidates all
three build types (production, development, session) into a
single workflow with a unified CI gate.
PR builds are now handled by the dedicated pr.yml workflow
which uses bakery-build-pr.yml (fork-safe, no secrets).
The if condition referenced cron '15 3 * * 0' but the actual
schedule is '15 4 * * 0'. With pull_request removed, simplify
to check event_name directly instead of matching cron strings.
Set top-level permissions: {} on all workflows and per-job
permissions: {} on CI meta-jobs and the issues job. This
follows the principle of least privilege by requiring each
job to explicitly declare the permissions it needs.
Top-level permissions on workflows that call reusable
workflows acts as a ceiling, blocking job-level grants
from reaching the callee. Remove it from all workflows
except issues.yml (which doesn't call reusable workflows).
Per-job permissions remain.
Mutable tags can be overwritten, allowing supply chain
attacks. Pin to immutable commit SHAs with specific
version comments so Dependabot can track updates.
Add zizmor job to PR workflows and a .github/zizmor.yml
policy that allows ref-pinned images-shared refs while
requiring hash-pinning for all third-party actions.
The release workflow was the only workflow without explicit
permissions, inheriting the repo default. Add least-privilege
permissions (contents:write, pull-requests:write) to match
what product-release.yml needs, plus a 10-minute timeout.
- Downgrade packages:write to packages:read on PR build jobs —
  PR builds never push, cache is read-only
- Add security-events:write to zizmor job for SARIF upload to
  the Security tab
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