feat(mcp): add hosted opportunity finder - #2699
Conversation
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-03 08:30:42 UTC
🛑 Suggested Action - Reject/Close
Review summary Blockers
Nits — 5 non-blocking
Why this is blocked
CI checks failing
Review context
Contributor next steps
Signal definitions
🟩 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.
|
| continue; | ||
| } | ||
| if (!(await this.canAccessRepo(repository.fullName))) { | ||
| warnings.push(`Skipping ${repository.fullName}: caller cannot access cached repository metadata.`); |
There was a problem hiding this comment.
Search mode leaks inaccessible cached repository names in warnings
When searchQuery is provided, the tool adds all registered repos to the scan set before access checks and then reveals their exact full names in warnings to unauthorized callers.
Move the access check before adding search-discovered repositories, or avoid naming inaccessible repos in warnings.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name="src/mcp/server.ts">
<violation number="1" location="src/mcp/server.ts:2294">
<priority>medium</priority>
<title>Search mode leaks inaccessible cached repository names in warnings</title>
<evidence>In the findOpportunities method, when a searchQuery is provided, the code fetches all registered repositories via listRepositories(this.env), adds them to repositoriesByName without verifying caller access, and later emits a warning containing the repository fullName when the caller lacks access: warnings.push(`Skipping ${repository.fullName}: caller cannot access cached repository metadata.`). This allows an unauthorized caller to probe for the existence and exact names of private or restricted cached repositories.</evidence>
<recommendation>Move the access check (this.canAccessRepo) before adding search-discovered repositories into the scan set, or change the warning to a generic count-based message that does not include repository names the caller is not authorized to see.</recommendation>
</violation>
</file>
16bb70b to
6a8a637
Compare
Summary
Adds
gittensory_find_opportunities, a hosted MCP tool that ranks contributor opportunities from cached repo/issue metadata only — no source upload, no GitHub writes. Giventargets(owner/repo) and/or asearchQuery, plus an optional minergoalSpecandlimit, it scores open issues with the sharedrankOpportunitiesengine and returns the top-ranked issues with their per-signal scores.targets(≤25 owner/repo),searchQuery(≤200 chars),goalSpec(MinerGoalSpec),limit(1–25, default 10). Requires at least one oftargetsorsearchQuery.potential,feasibility,laneFit,freshness,dupRisk, ranked via@jsonbored/gittensory-engine.{ source: "cached_metadata", searchedRepositories, candidateCount, opportunities[], warnings? }; each opportunity carriesowner/repo/issueNumber/title/rankScore/laneFit/freshness/dupRisk/aiPolicyAllowed.warnings), drops claimed or duplicate issues (dupRisk >= 1), sanitizes titles viasanitizePublicComment, and returns an empty result whengoalSpec.minerEnabledisfalse.Reinstates the previously-removed
gittensory_find_opportunitiestool name with this metadata-only implementation.Related issue
Closes: #2308
Change Type (select all that apply)
Real behavior proof
Driven end-to-end through a connected MCP test client (the tool itself is not mocked):
octo/demowith four issues; verifies it dedupes repeated targets, ranks the maintainer-authored bug above the question issue, drops theduplicate-labeled and already-claimed (Closes #3) issues, falls back to neutral freshness on an unparsableupdated_at, and leaks nohotkey/coldkey/wallet/payout/reward.searchQuerymatches only registered, accessible cached repos; excludes a private repo the caller can't read (with a warning), warns on unregistered/missing targets, appliesissueDiscoveryPolicy: "discouraged"(
laneFit0.35), returns empty forminerEnabled:false, and errorstargets_or_search_query_requiredwhen neithertargetsnorsearchQueryis given.