Skip to content

🔒 security: adoption re-home moves fork PR code into an in-repo branch, so it runs with trusted CI (signed image published from unreviewed fork code) #14302

Closed as not planned

Description

@Danathar

Summary (security, high priority)

When the hive supersedes an adopted fork PR, including the DCO re-home, it pushes the fork's commits to a hive-owned branch inside the base repository and opens a new PR from that branch. The new PR is a same-repository PR. GitHub and the repository's own workflows therefore treat it as trusted: secrets are available, pull_request workflows get write tokens, and fork-only guards do not fire.

The result is that fork code no maintainer has reviewed runs with the repository's trusted CI identity. That bypasses the controls a repository sets up specifically for fork PRs. The hive should never raise a change's trust level by moving it.

Evidence

All times below are 2026-10-25 UTC.

So an unreviewed fork commit produced a signed, published image under the project's identity, with a permanent transparency-log record. That is exactly what the repository's fork guard and maintainer-run fork canary exist to prevent.

Where

At v6 becce0a8c, src/pkg/github/automerge/automerge_contributor_adopt.go:

  • adoptContributorPR (:552): when in-place adoption is not possible or adoptionNeedsDCORehome (:595), it calls supersedeAdoptedPR.
  • supersedeAdoptedPR (:610): creates the hive/adopt-<n> branch in the base repository from the fork's head and opens the superseding PR.
  • AdoptReasonDCORehome (:100): the second takeover of an in-place adoption.

The same applies to any supersession of a fork PR, not only the DCO re-home.

Ask

  1. Never re-home or supersede a fork PR into the base repository while it carries code nobody trusted has reviewed. Acceptable shapes:
    • park at 085 for a maintainer instead;
    • only after a trusted maintainer has approved the exact head being moved;
    • push to a branch outside the base repository.
  2. Never re-home or supersede in a repository with fork-publication or fork-secrets guards. A small configurable per-repo opt-out works, as does detecting the guard (see the fork-guard routing below).
  3. If a superseded PR keeps its own branch in-repo for any reason, mark it so repository gates can treat it as a fork, for example with a label the repository's workflows can check. This is weaker than 1 and 2 and not sufficient on its own.
  4. Audit: list existing hive/adopt-* branches and PRs whose original was a fork PR, so maintainers can review what ran.

Acceptance criteria

  • A fork PR is never moved to an in-repo branch without a trusted maintainer's approval of that exact head.
  • In a repo configured as having a fork guard, no supersession or DCO re-home of a fork PR happens at all; the PR parks at 085 with a maintainer note.
  • The adoption and superseding-PR notes say the PR came from a fork and why it was not moved.
  • Tests cover: a fork PR plus DCO re-home without approval (not moved), a fork PR with approval of the current head (moved), and a same-repo PR (unchanged).

Related

  • The pending v6 PR for fork-guard routing (forward-port of 🐛 fix(stageengine): park fork PRs failing a fork-publication guard for a maintainer #14282) parks a fork PR whose only red check is a fork guard at 085, which does not yield to adoption. That removes this path for that one shape. It does not fix this issue: a fork PR with any other red check, or only a DCO problem, can still be adopted and re-homed in-repo.
  • Adoption of a maintainer's own PR is filed separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

Activity

  1. added
    priority/highHighest priority. Must be actively worked on as someone's top priority right now.
    kind/bugCategorizes issue or PR as related to a bug.
    on Oct 25, 2026
  2. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Oct 25, 2026
  3. hivecommons-hive commented on Oct 25, 2026

    @hivecommons-hive
    Contributor

    🔒 Claimed by @arteeh (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply /unclaim to release, or /claim to take it over if you outrank the holder.

  4. hivecommons-hive commented on Oct 25, 2026

    @hivecommons-hive
    Contributor

    stage 020-claimed → 010-actionable: actionable

  5. added
    stage/020-claimedClaimed by the scanner or a relay contributor
    and removed
    stage/010-actionableTriaged; eligible for the hive to pick up
    on Oct 25, 2026
  6. Danathar commented on Oct 25, 2026

    @Danathar
    ContributorAuthor

    Superseded by a PR that implements the fix directly: #14306

  7. hivecommons-hive commented on Oct 25, 2026

    @hivecommons-hive
    Contributor

    🔓 Claim by @arteeh released (lease revoked).

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

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.priority/highHighest priority. Must be actively worked on as someone's top priority right now.security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions