From 4a995851154409b238ba433b1ea1034a47a79944 Mon Sep 17 00:00:00 2001 From: Karibhou Date: Wed, 4 Nov 2026 18:59:02 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20require=20sign-off=20for?= =?UTF-8?q?=20workflow=20review=20questions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hive-Run: hivecommons/hive#16638 Hive-Plan: workflow review policy sign-off Hive-Spec: reviewer-question-auto-decide#policy-sign-off Signed-off-by: Karibhou --- changelog.d/security-16638-workflow-review.md | 1 + .../operator-reference/sweeps-and-operations.md | 2 +- src/pkg/review/decision_question_class.go | 10 +++++----- src/pkg/review/decision_question_class_test.go | 13 +++++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 changelog.d/security-16638-workflow-review.md diff --git a/changelog.d/security-16638-workflow-review.md b/changelog.d/security-16638-workflow-review.md new file mode 100644 index 0000000000..7d9fd74cd0 --- /dev/null +++ b/changelog.d/security-16638-workflow-review.md @@ -0,0 +1 @@ +- Require human policy sign-off for reviewer questions on workflow and action edits, including same-repository PRs. diff --git a/src/docs/operator-reference/sweeps-and-operations.md b/src/docs/operator-reference/sweeps-and-operations.md index 3c7117cd48..4b6c6e5156 100644 --- a/src/docs/operator-reference/sweeps-and-operations.md +++ b/src/docs/operator-reference/sweeps-and-operations.md @@ -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 diff --git a/src/pkg/review/decision_question_class.go b/src/pkg/review/decision_question_class.go index 3abfd5c968..f945614b3d 100644 --- a/src/pkg/review/decision_question_class.go +++ b/src/pkg/review/decision_question_class.go @@ -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" @@ -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 @@ -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 diff --git a/src/pkg/review/decision_question_class_test.go b/src/pkg/review/decision_question_class_test.go index aa88efd1da..7083b1ebec 100644 --- a/src/pkg/review/decision_question_class_test.go +++ b/src/pkg/review/decision_question_class_test.go @@ -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",