diff --git a/changelog.d/security-no-fork-rehome-into-base-repo.md b/changelog.d/security-no-fork-rehome-into-base-repo.md new file mode 100644 index 0000000000..1bf9a52a6c --- /dev/null +++ b/changelog.d/security-no-fork-rehome-into-base-repo.md @@ -0,0 +1 @@ +- **Security:** contributor adoption no longer moves a fork pull request's commits into a `hive/adopt-` branch of the base repository (supersede, DCO re-home, or in-place-stalled re-home). The re-homed PR was a same-repository PR, so the fork's unreviewed code ran with the repository's trusted CI and skipped its fork-only guards; one such run published and signed a canary image. A fork PR the hive cannot finish on the fork's own branch now parks at `stage/085-needs-decision` (`adoption-stalled:fork-rehome-refused`) with a maintainer ask. PRs from branches of the base repository are re-homed as before. diff --git a/src/docs/hive-merge.md b/src/docs/hive-merge.md index c8eac79940..aaeba86d71 100644 --- a/src/docs/hive-merge.md +++ b/src/docs/hive-merge.md @@ -598,7 +598,14 @@ sweep's own red-PR route: the superseding App PR it opens from `hive/adopt-` is red with the contributor's failures, lands in `ci-failing.json` like any hive-authored red PR, and the scanner's FIX-BEFORE-NEW kick rebases and fixes it on that branch (never a replacement PR), after which it follows the normal -`050 → 100` path. When adoption is in-place on the contributor PR's own +`050 → 100` path. A **fork** PR (or one whose head repository is unknown) +is never superseded or re-homed into `hive/adopt-`: a branch in the base +repository makes a same-repository PR, which runs with the repository's +secrets and write tokens and skips its fork-only guards, so unreviewed fork +code would run as trusted. The hive records the refusal and the next pass +parks the PR at `085` as `adoption-stalled:fork-rehome-refused` with a +maintainer ask; in-place adoption on the fork's own branch (when the +contributor allows maintainer edits) is unchanged. When adoption is in-place on the contributor PR's own branch, a changed head stays adopted only with hive-controlled evidence (GitHub-linked App commit metadata; the stage store only remembers SHAs that already passed that check); diff --git a/src/docs/labels-and-control-signals.md b/src/docs/labels-and-control-signals.md index bca83526d0..52e1518d27 100644 --- a/src/docs/labels-and-control-signals.md +++ b/src/docs/labels-and-control-signals.md @@ -224,7 +224,7 @@ referenced it) a lone `stage/050-review-pending` | `stage/070-fixing` | PR | hive-owned repair: App/taken-over PR red, changes requested (by the swarm, or by a trusted human's **changes requested** review / `/hive decision ` on the current head — reason `human-changes-requested`, which also kicks the author agent with the text verbatim, [#13041](https://github.com/hivecommons/hive/issues/13041)) or needs-rebase, **or** a non-App PR whose red head was caused by a hive-pushed commit that must be removed/re-homed; a hive agent is reworking it | 2h | | `stage/071-needs-author` | PR | human-authored PR (`author/human`): CI red / changes requested / conflicting; the hive posted its diagnosis, the author must act. No nudge, no adoption — the person pushes or comments | 24h | | `stage/072-returned-to-contributor` | PR | clanker PR (`author/clanker`, relay or external hive): CI red / changes requested / conflicting; the hive posted its diagnosis, the ball is in the contributor hive's court. (Briefly spelled `stage/072-needs-author` by [#12713](https://github.com/hivecommons/hive/pull/12713); the engine renames that label back in place) | 24h | -| `stage/074-adopted-by-hive` | PR | the author (a clanker) was unavailable — relay offline, never registered, or silent past the grace (see below); the hive took the PR over: in place on the PR's own branch when it may push there (the scanner's red-PR fix kick rebases and fixes it), otherwise via `hive/adopt-` and a superseding App PR that keeps the author's commits (the original closes automatically when the superseder merges). Adoption is an **ownership** state, not a CI state: the PR reads 074 for as long as the hive owns it — through its fixes going pending, green, reviewed or red again (074 outranks 050/060/070/071/072) — and leaves 074 only at the merge gate (080/085/090/100), when the adoption is released, or to 085 `adoption-stalled:` when the head sat unchanged past the dwell with CI idle and a real blocker the hive cannot push past — a red optional check alone never counts, and the escalation releases back to 074 as soon as the reason clears (an in-place adoption with a blocking review finding re-homes to `hive/adopt-` first instead; one with a squash-unsafe hive commit elects a merge commit on a `role/trusted` PR — `merge-method/merge` label, lane continues — and otherwise goes to 085 `adoption-stalled:hive-signoff-attribution` at once, without a supersede, naming why the election was refused). For in-place adoption, a changed head must be linked to the App bot by GitHub commit metadata (the stage store only remembers heads that already passed that check); otherwise the hive treats it as a contributor push and hands the PR back (072 if red, else the normal path). Forgeable git author/committer names and emails never keep 074. A PR whose author holds **admin** or **maintain** on the repository is never adopted or re-homed (one cached permission read per repo and author per hour; a failed read does not adopt), and an in-place adoption of such an author is released on the next pass. | 3h | +| `stage/074-adopted-by-hive` | PR | the author (a clanker) was unavailable — relay offline, never registered, or silent past the grace (see below); the hive took the PR over: in place on the PR's own branch when it may push there (the scanner's red-PR fix kick rebases and fixes it), otherwise via `hive/adopt-` and a superseding App PR that keeps the author's commits (the original closes automatically when the superseder merges). Adoption is an **ownership** state, not a CI state: the PR reads 074 for as long as the hive owns it — through its fixes going pending, green, reviewed or red again (074 outranks 050/060/070/071/072) — and leaves 074 only at the merge gate (080/085/090/100), when the adoption is released, or to 085 `adoption-stalled:` when the head sat unchanged past the dwell with CI idle and a real blocker the hive cannot push past — a red optional check alone never counts, and the escalation releases back to 074 as soon as the reason clears (an in-place adoption with a blocking review finding re-homes to `hive/adopt-` first instead; one with a squash-unsafe hive commit elects a merge commit on a `role/trusted` PR — `merge-method/merge` label, lane continues — and otherwise goes to 085 `adoption-stalled:hive-signoff-attribution` at once, without a supersede, naming why the election was refused). For in-place adoption, a changed head must be linked to the App bot by GitHub commit metadata (the stage store only remembers heads that already passed that check); otherwise the hive treats it as a contributor push and hands the PR back (072 if red, else the normal path). Forgeable git author/committer names and emails never keep 074. A PR whose author holds **admin** or **maintain** on the repository is never adopted or re-homed (one cached permission read per repo and author per hour; a failed read does not adopt), and an in-place adoption of such an author is released on the next pass. A fork PR is never superseded or re-homed into the base repository (that would run unreviewed fork code with the repository's trusted CI); it parks at `085` as `adoption-stalled:fork-rehome-refused` instead. | 3h | | `stage/080-awaiting-merge-admission` | PR | nothing left for the author: CI green (no red check on the head, required or not), verdict approve, no modifiers — and the automerge lane has not admitted it yet (prefilter not evaluated for this head, labels not synced, lane tripped). A stall here means a lane problem, so the hive also posts one `` comment with the lane's last skip reason | 30m | | `stage/085-needs-decision` | PR | **PR-only** since the owner decision of 2026-10-17 (issues park at `stage/045-needs-decision`; before that this stage carried both, [#12683](https://github.com/hivecommons/hive/issues/12683)). A person owes a **decision**, not a merge: a `requires_human` swarm verdict (reason `reviewer-verdict:requires_human`), `sentinel-alert`, `hold` / `do-not-merge*` / `needs-decision` modifier, no reviewer configured, GitHub workflow approval is required for a trusted same-repo bot/App/clanker PR (`workflow-approval-required:`); Hive has posted `/ok-to-test` and is waiting for the repo-local `hive-ok-to-test` workflow or a maintainer, or a human-only lane rule unrelated to trust (workflow-path edits, tests removed, human-merge path, reporter-trust hold), or an open issue the PR closes is held or parked (`linked-issue:hold:#N: