Skip to content

Self-hosted jobs: refuse a fork's pull-request jobs (MAWS is public) #168

Open

Description

@SSFSKIM

SSFSKIM/MAWS went public on 2026-10-26 (the owner's decision). Its jobs run on ci-kit's self-hosted machines: the mini, the EC2 Mac and the GCE/EC2 pool.

Two GitHub settings already keep outside code off them. MAWS allows only collaborators to create pull requests (pull_request_creation_policy=collaborators_only), and a fork pull request's workflows need approval from every external contributor (fork-pr-contributor-approval all_external_contributors).

A third layer, owned by ci-kit: the job-started hooks (mac/hooks on the Macs, pool/image/job-started.sh in the pool image) fail a job whose event payload is a pull request from another repository (pull_request.head.repo.full_name != repository.full_name). That covers the case where both settings lapse or someone approves a run by mistake. Deploy: mac/install.sh refresh on the mini and the EC2 Mac, plus a bake for the pool image.

Not urgent: no outsider can open a PR today.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)

Activity

  1. SSFSKIM commented on Oct 27, 2026

    @SSFSKIM
    OwnerAuthor

    Built the pool-side trigger guard in #171: public allow_public repositories launch only while every queued/in-progress run is push, workflow_dispatch or schedule; an unsafe run logs its id/event, drains idle unclaimed pool runners and opens one deduplicated alert. Private repos are unchanged; unreadable run snapshots launch nothing without causing a drain. No hook edits: runner source confirms a nonzero job-started hook still allows always()/failure() steps and action pre scripts, so it is not a security boundary. A MAWS static workflow check is also in preparation; persistent-Mac runtime denial remains a separate backlog design. Nothing deployed.

  2. SSFSKIM commented on Oct 27, 2026

    @SSFSKIM
    OwnerAuthor

    Scope update, 2026-10-27. The fail-the-job hook this issue proposes is not a guard. In actions/runner v2.338.0, a job-started hook that exits nonzero fails the job, but the runner still runs action pre scripts and every workflow step marked always() or failure(). A hostile workflow can therefore get past a hook that only fails the job. Action archives are prepared before the hook runs; ordinary success()-guarded container setup is skipped after the failure.

    What was built instead:

    • ci-kit#171: the launcher stops serving an allow_public repo while any of its runs has an event other than push, workflow_dispatch or schedule, and raises an alert. This covers the pool only.
    • MAWS#197: a static check that fails when a workflow that can reach a self-hosted runner triggers on any other event. This covers workflow configuration that goes through review. It does not cover a job already dispatched.

    Still open, and why this issue stays open: the persistent Macs (the mini and the EC2 Mac) have no per-job runtime boundary for public MAWS. Two designs to try:

    • the hook explicitly shuts down Runner.Worker (Worker.cs registers SIGTERM and calls ShutdownRunner, and StepsRunner skips every condition on RunnerShutdownToken);
    • admission outside the worker.

    Either one needs validation on a real runner and the owner's approval. No runtime change during the current wave.

    Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)

  3. SSFSKIM commented on Oct 27, 2026

    @SSFSKIM
    OwnerAuthor

    The companion MAWS static workflow-trigger guard is now open at SSFSKIM/MAWS#197 (head 2a5f8e7e0); its remote static gate passed: https://github.com/SSFSKIM/MAWS/actions/runs/40436121632. Pool launcher #171 (head f32cff3) also passed full ci-gate: https://github.com/SSFSKIM/ci-kit/actions/runs/40435939922. Neither PR is merged or deployed. Hook-based runtime denial remains deferred because nonzero hook exit is not a no-code boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions