fix(ci): remove all comment-based approval bypasses from review-check.sh #2364
Reference in New Issue
Block a user
Delete Branch "fix/review-check-remove-generic-comment-bypass"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Removes both generic-keyword and agent-prefix comment approval paths from the qa-review/security-review gate.
Security issue: Issue comments satisfied the gate without an official Gitea review. Both paths are bypasses:
Fix: Only APPROVED reviews from the Gitea reviews API count. The entire issue-comments fallback is removed.
Test updates:
Tests: 38 pass.
Requesting changes on current head
d7b1e4fbcc.The comment-bypass removal itself is present: the issue-comment fallback block is gone, CANDIDATES is now REVIEW_CANDIDATES only, and T15/T16/T18 are flipped to reject agent-prefix/generic comment paths.
However the new gate still does not satisfy the stated merge-control bar:
.gitea/scripts/review-check.sh still treats missing official as acceptable via
select(.official != false)around line 205. The requirement is official=true; this should beselect(.official == true)so non-official/missing official reviews cannot satisfy qa/security.Current-head binding is still optional. Lines 207-210 only apply
select(.commit_id == $head)when REVIEW_CHECK_STRICT=1, but qa-review.yml and security-review.yml set REVIEW_CHECK_STRICT: '0' on this head. That means stale official approvals can still satisfy the gate. The check must require commit_id == PR_HEAD_SHA unconditionally, or the workflows/tests must make strict mode the enforced production path.Add/adjust regression coverage for stale-head approval rejection and official-missing/non-official rejection, plus the positive current-head official APPROVED case.
Live CI is also not green yet: combined status is failure with sop-checklist, qa-review, security-review, and sop-tier-check red/pending. The merge-control issues above are the blockers.
5-axis re-review on current head
0dd86b4e58.Correctness: RC 9141 is addressed. review-check.sh now requires state=APPROVED, official == true, non-dismissed, non-author, and commit_id == current PR head unconditionally. The REVIEW_CHECK_STRICT conditional was removed, so workflows setting REVIEW_CHECK_STRICT=0 cannot allow stale approvals to count.
Robustness: the entire issue-comment approval fallback remains removed; generic APPROVED/LGTM/ACCEPTED comments and [core-qa-agent]/[core-security-agent] prefixes cannot satisfy the gate.
Security: closes both comment-bypass and stale/non-official review bypasses; missing/null official is rejected.
Performance: no material runtime impact.
Readability: the jq filter is simpler and tests document the security cases.
Regression coverage includes T15/T16/T18 comment rejections plus T21 stale-head rejection and T22 missing-official rejection; the default positive current-head official APPROVED case remains. Required branch-protection contexts are green (CI/all-required, E2E API Smoke, Handlers Postgres) and mergeable=true.
REQUEST_CHANGES: review-check.sh hardening itself looks correct, but this PR has a collateral merge-control regression in
.gitea/scripts/sop-tier-check.sh. Current main31283a292a34569ea3b3a06586d8cdd937438603has noSOP_FAIL_OPENreferences; head0dd86b4e589c8b353d34d9e18e6fb14b4538e775reintroducesSOP_FAIL_OPENbypass exits in sop-tier-check.sh (e.g. lines 72-73, 109-110, 122-123, 218-219, 275-276). That can turn token/API/jq failures into exit 0 when SOP_FAIL_OPEN=1, undoing the fail-closed hardening that just merged in #2362. Fix shape: remove the sop-tier-check.sh changes from this PR (or otherwise ensure no SOP_FAIL_OPEN fail-open path exists); keep the review-check.sh official/current-head/comment-removal changes and tests.0dd86b4e58tob1475b1f715-axis re-review on current head
b1475b1f71.Full-diff scope was checked against fresh origin/main
31283a292a:M .gitea/scripts/review-check.sh
M .gitea/scripts/tests/_review_check_fixture.py
M .gitea/scripts/tests/test_review_check.sh
sop-tier-check.sh is not in the diff, and SOP_FAIL_OPEN is absent on this branch's sop-tier-check.sh, so the stale-base regression from the prior head is gone.
Correctness/security: review-check.sh now requires state=APPROVED, official == true, non-dismissed, non-author, and commit_id == current PR head unconditionally. The entire issue-comment fallback remains removed, so generic approval comments and agent-prefix comments cannot satisfy qa/security.
Robustness: stale-head and missing/non-official reviews fail closed via T21/T22; T15/T16/T18 still reject comment paths; the positive current-head official review case remains.
Performance/readability: narrow shell/jq filter change with focused tests; no runtime concern.
Required branch-protection contexts are green (CI/all-required, E2E API Smoke, Handlers Postgres) and mergeable=true.
APPROVED on head
b1475b1f. Independent re-review: diff scope is only review-check.sh plus review-check tests; sop-tier-check.sh is not in the diff and SOP_FAIL_OPEN is absent. Comment approval fallback is removed, official==true is required, commit_id==head is unconditional, and T15/T16/T18/T21/T22 regressions are present. Required core CI is green and PR is mergeable.