Skip to content

fix(agent): restrict tracker suggestions to PR lifecycle actions - #3426

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-milestone-matcher-webhook-trigger
Jul 5, 2026
Merged

fix(agent): restrict tracker suggestions to PR lifecycle actions#3426
JSONbored merged 1 commit into
mainfrom
codex/fix-milestone-matcher-webhook-trigger

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Close a validated security issue where milestone/project suggestion work ran for any webhook payload containing payload.pull_request, allowing review/comment webhooks to trigger GitHub API work and token usage.
  • Suggestions should only run for lifecycle/title-body changes where matches can meaningfully change, avoiding amplification from attacker-triggerable review/comment events.

Description

  • Add an allowlist of PR actions (opened, edited, reopened, synchronize) and a shouldSuggestProjectTrackerForWebhook guard to src/integrations/project-tracker-adapter.ts.
  • Thread eventName and payload.action into maybeSuggestMilestoneMatchForPr and short-circuit early when the webhook is not a targeted pull_request lifecycle action in src/queue/processors.ts.
  • Add unit regressions in test/unit/project-tracker-adapter.test.ts that assert review webhooks and non-matching pull_request actions do not perform network calls.

Testing

  • Ran typecheck with npm run typecheck -- --pretty false, which succeeded.
  • Ran the focused unit suite npx vitest run test/unit/project-tracker-adapter.test.ts, which passed (42 tests).
  • Attempted the full local gate npm run test:ci, but the run could not be completed here because test:coverage surfaced unrelated/timeout failures in test/unit/backfill.test.ts and the job was terminated; the change is covered by targeted unit tests above.
  • npm audit --audit-level=moderate attempted and returned a 403 Forbidden from the registry audit endpoint in this environment (audit not completed here).

Codex Task

@superagent-security

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 06:46:26 UTC

3 files · 1 AI reviewer · no blockers · readiness 93/100 · CI pending · unknown

⏸️ Suggested Action - Manual Review

Review summary
The change moves project/milestone suggestion work behind a webhook allowlist and threads the actual webhook event/action from the processor into the adapter, which closes the review/comment webhook amplification path shown in the PR description. The early guard sits before installation/config/network work in maybeSuggestMilestoneMatchForPr, so non-targeted events short-circuit cleanly, and the added tests cover both a review webhook with a pull_request payload and a non-matching pull_request action. I do not see a reachable correctness or security regression in the visible diff.

Nits — 2 non-blocking
  • nit: src/integrations/project-tracker-adapter.ts:324 includes `synchronize` even though the nearby wording says title/body matching inputs change; either tighten the comment to say PR lifecycle actions or explain why pushes should still refresh tracker suggestions.
  • src/integrations/project-tracker-adapter.ts:324 could make the allowlist intent clearer with a short comment separating title/body changes (`opened`, `edited`, `reopened`) from the deliberate push-refresh case (`synchronize`), so this does not look like accidental over-inclusion later.
Signal Result Evidence
Code review ✅ No 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: 56 registered-repo PR(s), 46 merged, 416 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 56 PR(s), 416 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 56 PR(s), 416 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.
  • No action.
  • 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

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.46%. Comparing base (4ce6b61) to head (4c4b72c).
⚠️ Report is 23 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3426   +/-   ##
=======================================
  Coverage   93.46%   93.46%           
=======================================
  Files         287      287           
  Lines       30763    30766    +3     
  Branches    11210    11212    +2     
=======================================
+ Hits        28752    28755    +3     
  Misses       1355     1355           
  Partials      656      656           
Files with missing lines Coverage Δ
src/integrations/project-tracker-adapter.ts 100.00% <100.00%> (ø)
src/queue/processors.ts 93.02% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Development

Successfully merging this pull request may close these issues.

1 participant