Skip to content

[sec-check] human_merge_pin_only waives the human-merge-path hold on PR author login alone — head commits and action SHA upstream reachability are never verified #16399

Closed

Description

@hivecommons-hive

Security Finding

Severity: medium
Type: unsafe-pattern (merge-gate bypass)

auto_merge.human_merge_pin_only (#16266, src/pkg/github/automerge/automerge_human_paths.go humanMergePinOnlyExempt) waives the human-merge-path hold when the PR author login is in trusted_authors, the changed-file count matches, and intent.ClassifyPinOnly accepts the diff. Nothing in that path looks at the commits that make up the head:

  1. Commit provenance is not checked. pr.GetUser() is the login that opened the PR. Any principal with write access to the repository can push further commits onto a same-repo branch owned by a trusted author (for example a dependabot/... branch — the PR stays authored by dependabot[bot]), and a fork PR is pushable by anyone the fork owner lets in or via "maintainers can edit". The sweep lane and /approve then admit the new head with no person in the loop, which is exactly the population (contents: write agents and App tokens) that human_merge_paths exists to keep out of .github/workflows/** and Containerfile.
  2. The new action SHA is not tied to the upstream action. For action-sha, the classifier (src/pkg/intent/pin_only.go actionPinRE) only requires owner/repo@<40-hex> to keep the same prefix and change the hex. GitHub Actions resolves a uses: SHA through the whole fork network of owner/repo, so a 40-hex commit pushed to any fork of actions/checkout is a valid pin. Combined with (1), one pin-shaped line swap lands attacker-controlled workflow code; the # vN comment is cosmetic.

pin_only.go already says callers "MUST separately prove … authenticated trusted authorship, and review of each referenced upstream change", and docs/hive-merge.md repeats that the classifier is "syntax only" — but no caller supplies either proof today, and the docs describe trusted_authors as an "authenticated author allowlist", which the current check is not.

Mitigation today: the key is opt-in and the operator reference says no rollout is enabled yet, so exposure is zero until a repo turns it on. It should be closed before projectbluefin/utah#1082 enables it.

Impact

With the exception enabled, a write-access principal that is not a trusted author can bypass the human-merge-path hold by pushing a pin-shaped commit to a trusted author's PR branch (or by opening a fork PR under a trusted-author account it controls), and the admitted SHA may point at a fork-network commit nobody reviewed. Result: unreviewed workflow or container-base changes merged by the App into a protected path — the failure mode the gate is meant to prevent.

Recommendation

Both checks live next to humanMergePinOnlyExempt so the sweep lanes and /approve stay in agreement; they run only after the classifier accepts, so the no-extra-API-call property is kept for every PR that is held anyway.

  • Commit provenance (fail closed). List the PR's commits (PullRequests.ListCommits, paginated, refuse >250 / API error / empty list / head SHA absent from the list) and require, for every commit, author.login ∈ trusted_authors (same case-insensitive match as the PR author) and commit.verification.verified == true. The verified signature is what makes the login non-spoofable: a locally crafted commit can set dependabot's author email, but cannot carry GitHub's signature. Dependabot/Renovate commits are web-flow signed, so this costs the intended authors nothing; a human trusted author must sign.
  • Upstream reachability for action-sha. Have ClassifyPinOnly return the (owner/repo, newSHA, versionComment) triples it accepted, and before admitting resolve each one against the upstream action repo: when a # vX[.Y[.Z]] comment is present, git/ref/tags/vX… (dereferencing annotated tags) must equal newSHA; otherwise CompareCommits(newSHA, defaultBranch) must report newSHA as an ancestor (ahead/identical). Any 404 / mismatch / rate-limit → hold. The same shape applies to image-digest only if the operator wants it; digests are content-addressed, so the fork-network problem does not apply there.

Update docs/hive-merge.md and docs/operator-reference/README.md#human-merge-pin-only-rollout to state what the exception now proves (authenticated commits, upstream-anchored pins) instead of listing those as caller obligations.

Decision taken by hive: fail closed on unsigned commits rather than add a per-repo "allow unverified" knob; the exception is opt-in and aimed at bot authors whose commits GitHub signs.


Filed by sec-check agent (ACMM L6 — full mode)


🐝 Hive Agent: security | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 50197bbba

— hive: agent=sec-check backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Nov 3, 2026
  2. hivecommons-hive commented on Nov 3, 2026

    @hivecommons-hive
    ContributorAuthor

    PR #16400 covers this issue: #16400

    The PR body says this is partial/non-closing work (Refs/Part of or leave-open wording), so Hive will not add a closing keyword. GitHub will not show its issue-list PR icon without a closing keyword; the stage comment is the link.

  3. hivecommons-hive commented on Nov 3, 2026

    @hivecommons-hive
    ContributorAuthor

    task-list sweep: 1 of 2 items ticked. Not closing yet — outstanding boxes remain.

    Outstanding items:

    • 🔲 Upstream reachability for action-sha. Have ClassifyPinOnly return the (owner/repo, newSHA, versionComment) triples it accepted, and before admitting resolve each one against the upstream action repo: when a # vX[.Y[.Z]] comment is present, git/ref/tags/vX… (dereferencing annotated tags) must equal newSHA; otherwise CompareCommits(newSHA, defaultBranch) must report newSHA as an ancestor (ahead/identical). Any 404 / mismatch / rate-limit → hold. The same shape applies to image-digest only if the operator wants it; digests are content-addressed, so the fork-network problem does not apply there.

    Not yet touched: Containerfile, src/pkg/intent/pin_only.go, pin_only.go

    Merged PRs referencing this issue so far:

    This comment is edited in place by the task-list sweep on every cycle; it is not duplicated.

  4. hivecommons-hive commented on Nov 3, 2026

    @hivecommons-hive
    ContributorAuthor

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

  5. hivecommons-hive commented on Nov 3, 2026

    @hivecommons-hive
    ContributorAuthor

    🔓 Claim by agent scanner released (holding agent relaunched).

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

    agent/scannerCreated or modified by the scanner agentagent/sec-checkCreated or modified by the sec-check agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/claimed-by-sec-checkhive/partially-addressedA merged PR addressed only part of this issue; remainder still actionablesecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions