Skip to content

fix(review): keep automated E2E generation comment-only (prevent unauthenticated commit delivery) - #4358

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-auto-test-generation-vulnerability
Jul 9, 2026
Merged

fix(review): keep automated E2E generation comment-only (prevent unauthenticated commit delivery)#4358
JSONbored merged 1 commit into
mainfrom
codex/fix-auto-test-generation-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The manifest_missing_tests auto-trigger could reach the shared generation-and-delivery helper and, in repos configured with review.e2e_test_delivery: "commit", attempt privileged GitHub writes without requiring maintainer authorization, violating the existing maintainer-only boundary for write-capable test delivery.

Description

  • Force the automated manifest_missing_tests path to use comment-only delivery by making runE2eTestGenerationAndDeliver treat args.trigger === "auto" as deliveryMode = "comment", preventing the auto path from attempting commits to PR head branches.
  • Extend the auto-trigger test helper to accept e2eTestDelivery in the seeded manifest so repositories can be configured with review.e2e_test_delivery: "commit" during tests.
  • Add a regression unit test that seeds a manifest with commit delivery, stubs Git write endpoints, and asserts the automated trigger posts a comment and makes no git tree/commit/ref write attempts.

Testing

  • Ran the focused unit test suite with npx vitest run test/unit/queue.test.ts -t "manifest_missing_tests auto-trigger" and the modified tests passed.
  • Ran the single added test with npx vitest run test/unit/queue.test.ts -t "keeps the automated manifest_missing_tests trigger comment-only" and it passed.
  • tsc --noEmit failed locally due to missing aws4fetch type declarations in the environment.
  • npm run test:ci progressed through early checks but was blocked by cf-typegen:check (stale worker-configuration.d.ts) and external environment/network issues prevented npm audit --audit-level=moderate from completing (registry returned 403).

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 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.94%. Comparing base (c4432b4) to head (dba15e5).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4358   +/-   ##
=======================================
  Coverage   93.94%   93.94%           
=======================================
  Files         397      397           
  Lines       36744    36744           
  Branches    13430    13430           
=======================================
  Hits        34519    34519           
  Misses       1569     1569           
  Partials      656      656           
Files with missing lines Coverage Δ
src/queue/processors.ts 95.37% <100.00%> (ø)
🚀 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 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-09 04:45:36 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 diff closes a real authorization gap: previously the automated manifest_missing_tests trigger computed deliveryMode solely from the repo's review.e2e_test_delivery config, so a repo configured with "commit" delivery would let the unattended auto-trigger attempt privileged git writes with no maintainer invoker to authorize it. The fix forces deliveryMode to "comment" whenever args.trigger === "auto" in src/queue/processors.ts, correctly short-circuiting the downstream `deliveryMode === "commit"` branch that guards the git tree/commit/ref calls. The added test exercises the real processJob path (not a fabricated helper), stubs the git write endpoints to fail loudly if hit, and asserts zero writes plus a posted comment, which is genuine coverage of the previously-reachable bad path rather than a manufactured scenario.

Nits — 5 non-blocking
  • src/queue/processors.ts uses the bare string literal "auto" for the trigger check; if other trigger values are ever introduced elsewhere in the file it'd be safer to reference a shared constant/type instead of a magic string.
  • The new test only covers the auto-trigger with commit delivery configured; consider also asserting the existing explicit-maintainer-command path still honors "commit" delivery so a future regression can't silently force comment-only for that path too.
  • seedAutoTriggerPr's opts.e2eTestDelivery is optional and spread conditionally — worth a one-line comment noting why omitting it must fall back to the manifest default, so the test helper's intent isn't lost on future edits.
  • Add a companion test (or confirm one exists) verifying a maintainer-invoked (non-auto) trigger with e2e_test_delivery: commit still reaches the commit path, to lock in that the fix didn't overcorrect.
  • Consider naming the trigger value check against an enum/type (e.g. a TriggerKind union) rather than a raw string comparison for future-proofing.

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: 49 registered-repo PR(s), 41 merged, 504 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 49 PR(s), 504 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: not available
  • Official Gittensor activity: 49 PR(s), 504 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 9, 2026
@JSONbored
JSONbored merged commit cd0d2c4 into main Jul 9, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/fix-auto-test-generation-vulnerability branch July 9, 2026 05:03
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