Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/security-16638-workflow-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Require human policy sign-off for reviewer questions on workflow and action edits, including same-repository PRs.
2 changes: 1 addition & 1 deletion src/docs/operator-reference/sweeps-and-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ between. Two mechanisms close that gap
|---|---|---|
| `scanner.skip_issues_with_open_pr` | `true` (unset) | Set `false` to turn off both the pre-dispatch guard and the duplicate-fix sweep; the claim ledger alone then decides, as before. |
| `governor.auto_close_superseded` | `true` (unset) | At ACMM L6, a **hive-authored** PR whose closing targets are all closed, one of them by a different merged PR, and whose head conflicts with the base (or whose files are a subset of that PR's) is closed by the hive itself as superseded — `hive/superseded`, one notice naming the superseding PR — in the self-authored auto-merge lane (before any review cycle), the supersession sweep, and close-on-merge of the superseding PR. Human-authored PRs are never auto-closed. Set `false` to report the refusal once and leave the PR for a person, as before ([#14965](https://github.com/hivecommons/hive/pull/14965)). See [labels-and-control-signals.md § Supersession](../labels-and-control-signals/stage-labels.md#supersession-closed-issue-another-merged-pr). |
| `governor.review.auto_decide_questions` | `true` (unset) | A review perspective that ends with a **question** rather than a finding used to park the PR at 085 "Needs human decision" on its wording alone. The dashboard now classifies the ask. **Policy sign-off** stays a person's: the PR edits `.github/workflows/*` or `.github/actions/*` from a fork; touches OWNERS / CODEOWNERS / SECURITY / rulesets / secrets / key material; adds or removes `auto_merge`, `human_merge_paths` or `self_authored_decision_policy` config; or the ask names an owner-only guard (sentinel, GitHub/App permissions, unauthorized, tokens / secrets / credentials, branch protection). **Scope / follow-up question** — "should we also…", "merge ahead of…", "apply X from the PR body", "confirm Y is acceptable" — on a hive-authored (or hive-adopted) PR with CI green and no unresolved finding on the head runs the existing *Let hive decide* pipeline with the hive as requester: an approve verdict admits the PR to the merge queue and files the question as a `follow-up: …` issue linked to the PR; a direction verdict routes the fixer (070); an owner-only or recommend-only verdict keeps the 085 park with the hive's recommendation on the row ("needs your sign-off"). At most one auto-decide per head (a new push asks again), one INFO line `reviewer question auto-decided` per run, and `review_questions_autodecided_1h` on `/api/status`. Set `false` to park every reviewer question for a person, as before. |
| `governor.review.auto_decide_questions` | `true` (unset) | A review perspective that ends with a **question** rather than a finding used to park the PR at 085 "Needs human decision" on its wording alone. The dashboard now classifies the ask. **Policy sign-off** stays a person's: the PR edits `.github/workflows/*` or `.github/actions/*`, regardless of PR origin; touches OWNERS / CODEOWNERS / SECURITY / rulesets / secrets / key material; adds or removes `auto_merge`, `human_merge_paths` or `self_authored_decision_policy` config; or the ask names an owner-only guard (sentinel, GitHub/App permissions, unauthorized, tokens / secrets / credentials, branch protection). **Scope / follow-up question** — "should we also…", "merge ahead of…", "apply X from the PR body", "confirm Y is acceptable" — on a hive-authored (or hive-adopted) PR with CI green and no unresolved finding on the head runs the existing *Let hive decide* pipeline with the hive as requester: an approve verdict admits the PR to the merge queue and files the question as a `follow-up: …` issue linked to the PR; a direction verdict routes the fixer (070); an owner-only or recommend-only verdict keeps the 085 park with the hive's recommendation on the row ("needs your sign-off"). At most one auto-decide per head (a new push asks again), one INFO line `reviewer question auto-decided` per run, and `review_questions_autodecided_1h` on `/api/status`. Set `false` to park every reviewer question for a person, as before. |

## What hive writes to GitHub, and when

Expand Down
10 changes: 5 additions & 5 deletions src/pkg/review/decision_question_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type DecisionQuestionClass string

const (
// DecisionQuestionPolicySignOff: the ask stays a person's. The PR edits
// workflows from a fork, touches secrets / permissions / OWNERS /
// workflows, touches secrets / permissions / OWNERS /
// security-labelled paths, changes the auto-merge or human-merge
// policy, or the reviewer names an owner-only guard outright.
DecisionQuestionPolicySignOff DecisionQuestionClass = "policy-sign-off"
Expand Down Expand Up @@ -75,8 +75,8 @@ var decisionPolicyPaths = []string{
"**/.env*", "**/*.pem", "**/*.key", "**/id_rsa*", "**/secrets*",
}

// decisionWorkflowPaths are the CI-automation paths a fork may not edit
// without a person's sign-off (the App cannot push them either).
// decisionWorkflowPaths are CI-automation paths whose edits require a
// person's sign-off, regardless of where the PR originates.
var decisionWorkflowPaths = []string{".github/workflows/**", "**/.github/workflows/**", ".github/actions/**"}

// decisionPolicyConfigKeys are hive config keys whose change in a patch is
Expand Down Expand Up @@ -115,8 +115,8 @@ func ClassifyDecisionQuestion(in DecisionQuestionInput) (DecisionQuestionClass,
if p == "" {
continue
}
if in.FromFork && intent.PathMatchesAny(p, decisionWorkflowPaths) {
return DecisionQuestionPolicySignOff, "fork PR edits workflow path " + p
if intent.PathMatchesAny(p, decisionWorkflowPaths) {
return DecisionQuestionPolicySignOff, "PR edits workflow path " + p
}
if intent.PathMatchesAny(p, decisionPolicyPaths) {
return DecisionQuestionPolicySignOff, "PR touches policy path " + p
Expand Down
13 changes: 9 additions & 4 deletions src/pkg/review/decision_question_class_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ func TestClassifyDecisionQuestion(t *testing.T) {
name: "fork PR editing a workflow is a sign-off",
in: DecisionQuestionInput{Question: "Should the new job run on pull_request_target?", HiveAuthored: true, CIGreen: true, FromFork: true,
Files: []DecisionQuestionFile{{Path: ".github/workflows/ci.yml"}}},
want: DecisionQuestionPolicySignOff, reason: "fork PR edits workflow path",
want: DecisionQuestionPolicySignOff, reason: "PR edits workflow path",
},
{
name: "same-repo hive PR editing a workflow is still the hive's",
in: green("Should this merge ahead of the docs refresh?", DecisionQuestionFile{Path: ".github/workflows/docs.yml"}),
want: DecisionQuestionScope,
name: "same-repo hive PR editing a workflow requires sign-off",
in: green("Should permissions: contents be write?", DecisionQuestionFile{Path: ".github/workflows/ci.yml", Patch: "+permissions:\n+ contents: write\n"}),
want: DecisionQuestionPolicySignOff, reason: "PR edits workflow path",
},
{
name: "same-repo hive PR editing an action requires sign-off",
in: green("Should this merge ahead of the docs refresh?", DecisionQuestionFile{Path: ".github/actions/build/action.yml"}),
want: DecisionQuestionPolicySignOff, reason: "PR edits workflow path",
},
{
name: "OWNERS edit is a sign-off however it is phrased",
Expand Down
Loading