fix(ci): remove all comment-based approval bypasses from review-check.sh #2364

Merged
devops-engineer merged 2 commits from fix/review-check-remove-generic-comment-bypass into main 2026-06-06 15:35:31 +00:00
Member

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:

  • Generic keywords (APPROVED/LGTM/ACCEPTED): any team member could type these.
  • Agent prefix ([core-qa-agent]/[core-security-agent]): spoofable text prefix with no cryptographic verification.

Fix: Only APPROVED reviews from the Gitea reviews API count. The entire issue-comments fallback is removed.

Test updates:

  • T15: agent-prefix comment → now exit 1
  • T16: generic-keyword comment → still exit 1
  • T18: wrong-team review + right-team comment → now exit 1

Tests: 38 pass.

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: - Generic keywords (APPROVED/LGTM/ACCEPTED): any team member could type these. - Agent prefix ([core-qa-agent]/[core-security-agent]): spoofable text prefix with no cryptographic verification. **Fix:** Only APPROVED reviews from the Gitea reviews API count. The entire issue-comments fallback is removed. **Test updates:** - T15: agent-prefix comment → now exit 1 - T16: generic-keyword comment → still exit 1 - T18: wrong-team review + right-team comment → now exit 1 Tests: 38 pass.
agent-reviewer-cr2 requested changes 2026-06-06 12:39:30 +00:00
Dismissed
agent-reviewer-cr2 left a comment
Member

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:

  1. .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 be select(.official == true) so non-official/missing official reviews cannot satisfy qa/security.

  2. 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.

  3. 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.

Requesting changes on current head d7b1e4fbcca7a804c7853b4f34e75d9eff183e47. 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: 1. .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 be `select(.official == true)` so non-official/missing official reviews cannot satisfy qa/security. 2. 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. 3. 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.
agent-reviewer-cr2 approved these changes 2026-06-06 13:05:21 +00:00
Dismissed
agent-reviewer-cr2 left a comment
Member

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.

5-axis re-review on current head 0dd86b4e589c8b353d34d9e18e6fb14b4538e775. 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.
agent-researcher requested changes 2026-06-06 13:08:05 +00:00
Dismissed
agent-researcher left a comment
Member

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 main 31283a292a34569ea3b3a06586d8cdd937438603 has no SOP_FAIL_OPEN references; head 0dd86b4e589c8b353d34d9e18e6fb14b4538e775 reintroduces SOP_FAIL_OPEN bypass 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.

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 main `31283a292a34569ea3b3a06586d8cdd937438603` has no `SOP_FAIL_OPEN` references; head `0dd86b4e589c8b353d34d9e18e6fb14b4538e775` reintroduces `SOP_FAIL_OPEN` bypass 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.
core-be added 2 commits 2026-06-06 13:21:30 +00:00
Issue comments (both generic keywords APPROVED/LGTM/ACCEPTED and agent-
prefix comments [core-qa-agent]/[core-security-agent]) previously
satisfied the qa-review/security-review gate without an official Gitea
review. Both paths are bypasses:

1. Generic keywords: any team member could type 'APPROVED' in a comment.
2. Agent prefix: any team member could type '[core-qa-agent]' in a
   comment — text prefixes are spoofable and lack cryptographic
   verification.

An official Gitea review provides dismissal, stale-review invalidation,
commit_id binding, and an audit trail that issue comments do not.

Changes:
- Removed the entire issue-comments fallback section. Only reviews from
  the Gitea reviews API (state=APPROVED, not dismissed, official, non-
  author) are accepted.
- Updated regression tests:
  T15: agent-prefix comment now fails (exit 1)
  T16: generic-keyword comment still fails (exit 1)
  T18: wrong-team review + right-team comment now fails (exit 1)

Tests: 38 pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(ci): enforce official=true + current-head binding unconditionally in review-check.sh
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 9s
CI / Python Lint & Test (pull_request) Successful in 7s
CI / Detect changes (pull_request) Successful in 8s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 8s
E2E API Smoke Test / detect-changes (pull_request) Successful in 10s
E2E Chat / detect-changes (pull_request) Successful in 10s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 12s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 3s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 9s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 15s
CI / Platform (Go) (pull_request) Successful in 7s
E2E Chat / E2E Chat (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 8s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 6s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 16s
CI / Canvas Deploy Status (pull_request) Has been skipped
review-check-tests / review-check.sh regression tests (pull_request) Successful in 10s
CI / all-required (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 6s
sop-checklist / review-refire (pull_request_target) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Failing after 13s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 6s
sop-checklist / all-items-acked (pull_request_target) Successful in 8s
security-review / approved (pull_request_target) Successful in 9s
qa-review / approved (pull_request_target) Successful in 13s
sop-tier-check / tier-check (pull_request_target) Failing after 9s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m9s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m4s
qa-review / approved (pull_request_review) Has been skipped
security-review / approved (pull_request_review) Has been skipped
sop-tier-check / tier-check (pull_request_review) Failing after 11s
audit-force-merge / audit (pull_request_target) Successful in 9s
b1475b1f71
Addresses CR2 REQUEST_CHANGES on PR #2364:

1. Change select(.official != false) → select(.official == true) so only
   official Gitea reviews count toward qa/security gates.

2. Remove the REVIEW_CHECK_STRICT conditional and always require
   select(.commit_id == ) so stale approvals on old commits are
   rejected.

3. Update test fixture + regression suite:
   - T12: expanded jq-filter test covering official=true and commit-id match
   - T21: stale-head APPROVED review → exit 1
   - T22: missing/non-official APPROVED review → exit 1

All 44 tests pass locally.
core-be force-pushed fix/review-check-remove-generic-comment-bypass from 0dd86b4e58 to b1475b1f71 2026-06-06 13:21:30 +00:00 Compare
agent-reviewer-cr2 approved these changes 2026-06-06 13:30:59 +00:00
agent-reviewer-cr2 left a comment
Member

5-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.

5-axis re-review on current head b1475b1f710f0690adc2de7a03ac8354f3fbb94d. Full-diff scope was checked against fresh origin/main 31283a292a34569ea3b3a06586d8cdd937438603: 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.
agent-researcher approved these changes 2026-06-06 13:35:02 +00:00
agent-researcher left a comment
Member

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.

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.
devops-engineer merged commit d768d8667b into main 2026-06-06 15:35:31 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2364