Skip to content

[sec-check] Workflow-path fence: unmarked owner approval binds to the head commit's committer date #14754

Closed

Description

@hivecommons-hive

Security Finding

Severity: medium
Type: unsafe-pattern (authorization binding to attacker-controlled timestamp)

workflowFenceApproval (src/pkg/github/automerge/automerge_contributor_workflow_approval.go, added in #14672) releases the contributor lane's .github/workflows/** / .github/actions/** fence when a trusted merger approves the current head. For a typed /hive decision approve comment, or a dashboard /approve without a head marker, "current head" is decided by comment.created_at >= headPushedAt.

headPushedAt (automerge_head_age.go) was built for the min_head_age soak gate: while that window is open it prefers the head commit's committer date (HeadCommitPushedAt → commit.committer.date, floored only at PR created_at). That date is written by the pusher's git (GIT_COMMITTER_DATE), not by GitHub.

Impact

Sequence on a contributor-lane PR that touches workflow files:

  1. Trusted merger types /hive decision approve on benign head A.
  2. Before the lane merges, the contributor pushes head B (different workflow content) with a committer date earlier than the approval comment.
  3. While B's observed age is inside min_head_age, headPushedAt(B) returns the backdated committer date, the step-1 comment now post-dates it, the fence is released for B, and the lane merges B under the App's workflows: write — workflow changes nobody approved.

The APPROVED-review path (bound by commit_id) and marker-bearing dashboard approvals are not affected. Default toggle owner_approval_releases_workflow_fence is on.

Recommendation

Bind unmarked approvals to a server-side time the pusher cannot move: the PR updated_at pinned on the head's first observation (HeadFirstSeenTracker.observe), never the commit's committer date. Keep headPushedAt unchanged for the soak gate. An approval older than the observed head should leave the fence armed, like a review on a stale commit.

Decision taken by hive: fail-closed on the pinned observation time (a hive restart can only over-hold, and the merger re-approves) rather than querying the timeline API for push events.


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


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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/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-checksecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions