Skip to content

fix(review): require auto close for review evasion#4088

Merged
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-review-evasion-vulnerability
Jul 8, 2026
Merged

fix(review): require auto close for review evasion#4088
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-review-evasion-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • A recent default change made reviewEvasionProtection default to close, and the enforcement handlers treated auto_with_approval as an "acting" autonomy, which allowed review-evasion paths to perform live GitHub mutations without going through the approval queue.
  • This opened a window where repositories that used auto_with_approval for close could receive unapproved reopen/close PATCHes when a contributor self-closed, converted to draft, or repeatedly cycled draft state.

Description

  • Require the resolved close autonomy to be exactly auto (not just an acting level) before the review-evasion handlers perform live GitHub reopen/close mutations in src/queue/processors.ts.
  • When close resolves to auto_with_approval the handlers now deny enforcement and record an audit event indicating that the action "requires approval" instead of bypassing the approval flow; the same guard was added to the self-close, draft-conversion, and repeated draft-cycling handlers.
  • Added regression tests in test/unit/queue.test.ts that assert live PATCHes are not performed and that an audit event contains "requires approval" for the three review-evasion paths when close is auto_with_approval.
  • Preserved existing behaviors for reviewEvasionProtection: "off", close: "auto", dry-run mode, paused/frozen modes, and write-permission/readiness checks.

Testing

  • Ran npm run typecheck which completed successfully.
  • Ran focused unit tests with Vitest: npx vitest run test/unit/queue.test.ts -t "review-evasion protection" and the added regression -t "REGRESSION: denies live" suites, both passed locally.
  • Attempted npm run test:coverage but the full coverage run did not complete within this environment (run was attempted and stopped); full local gate (npm run test:ci) was not executed here.
  • Confirmed the modified files are src/queue/processors.ts and test/unit/queue.test.ts and that the change is limited to the enforcement gate and test coverage described above.

Codex Task

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.63%. Comparing base (9ba80b6) to head (278f5f1).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4088   +/-   ##
=======================================
  Coverage   93.63%   93.63%           
=======================================
  Files         384      384           
  Lines       35822    35828    +6     
  Branches    13146    13149    +3     
=======================================
+ Hits        33543    33549    +6     
  Misses       1618     1618           
  Partials      661      661           
Files with missing lines Coverage Δ
src/queue/processors.ts 95.07% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 8, 2026
@loopover-orb

loopover-orb Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-08 00:14:37 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This PR tightens the review-evasion enforcement gate in src/queue/processors.ts so live GitHub reopen/close PATCHes require the resolved close autonomy to be exactly "auto" rather than merely an "acting" level, closing the gap where auto_with_approval could bypass the approval queue for self-close, draft-conversion, and repeated draft-cycling paths. The change is narrowly scoped to the three handlers described, each gets a matching audit-detail branch and a regression test asserting no PATCH fires and the audit detail contains "requires approval" when close=auto_with_approval, which is a real behavioral difference from the prior isActingAutonomyLevel check (assuming auto_with_approval was previously classified as acting). No schema/migration/config-as-code changes are implicated, and CI is green across typecheck, tests, and coverage gates.

Nits — 5 non-blocking
  • The PR description does not reference an eligible open issue for this security-relevant behavior change; confirm it closes/links one per repo contribution conventions.
  • The three new regression tests aren't perfectly parallel in setup (e.g., self-close calls startActiveReviewTracking while the draft-conversion and draft-cycling regression tests don't appear to) — verify this matches the setup each handler actually requires rather than being copy-paste drift.
  • Consider extracting the repeated `closeAutonomy === "auto_with_approval" ? ... : ...` ternary audit-detail pattern into a small helper since it's now duplicated identically across three handlers.
  • Add a positive-path test confirming close: "auto" still performs the live PATCH after this change, to guard against over-tightening the condition.
  • If `isActingAutonomyLevel` is used elsewhere for similar gating decisions on the close autonomy, audit those call sites too for the same auto_with_approval bypass risk this PR just fixed in these three handlers.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 51 registered-repo PR(s), 43 merged, 496 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 51 PR(s), 496 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 51 PR(s), 496 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 8, 2026
@JSONbored
JSONbored merged commit 65ea80c into main Jul 8, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-review-evasion-vulnerability branch July 8, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

1 participant