Skip to content

fix(review): scope gittensor opt-in to installed repos#5110

Open
JSONbored wants to merge 1 commit into
mainfrom
codex/propose-fix-for-gittensor-plugin-vulnerability
Open

fix(review): scope gittensor opt-in to installed repos#5110
JSONbored wants to merge 1 commit into
mainfrom
codex/propose-fix-for-gittensor-plugin-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The self-hosted Gittensor opt-in logic could be triggered by registry-only (cached external) rows, allowing an external repo with experimental.gittensor: true to enable global refresh-registry work and downstream processing; the change closes this boundary bypass.

Description

  • Restrict gittensorEnabledRepoFullNames to only consider locally installed repos by skipping rows where repo.isInstalled is false in src/review/gittensor-wire.ts.
  • Clarify the function comment to document that registry-only snapshot rows are intentionally ignored to prevent external cached manifests from activating subnet work.
  • Add a regression unit test in test/unit/gittensor-wire.test.ts that seeds a registry-only repo (is_installed=0,is_registered=1) with experimental.gittensor: true and asserts it is excluded.
  • Preserve the existing behavior of not filtering on isRegistered to avoid a chicken-and-egg deadlock for newly-known-but-not-yet-registered installed repos.

Testing

  • Ran the targeted unit test with npx vitest run test/unit/gittensor-wire.test.ts --reporter=verbose, and all tests in that file passed.
  • Executed the repo-local checks (git diff --check) as part of validation and it passed.
  • Attempted the full coverage run via npm run test:coverage, but the full repository coverage run failed the global coverage thresholds (existing large-suite coverage shortfall in this environment) so a complete unsharded CI pass was not completed here.

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

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5110   +/-   ##
=======================================
  Coverage   94.13%   94.14%           
=======================================
  Files         466      466           
  Lines       39573    39574    +1     
  Branches    14436    14437    +1     
=======================================
+ Hits        37254    37255    +1     
  Misses       1664     1664           
  Partials      655      655           
Flag Coverage Δ
shard-1 46.50% <0.00%> (-0.02%) ⬇️
shard-2 33.44% <100.00%> (-0.12%) ⬇️
shard-3 31.60% <0.00%> (+0.25%) ⬆️
shard-4 32.70% <0.00%> (+0.01%) ⬆️
shard-5 33.18% <0.00%> (-0.24%) ⬇️
shard-6 45.14% <0.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/review/gittensor-wire.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

gittensory-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-11 15:20:55 UTC

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

⏸️ 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 closes a real gate-scoping gap: gittensorEnabledRepoFullNames previously iterated all locally-known repos regardless of install state, so a registry-only (cached external) row with experimental.gittensor: true in its manifest could enable subnet activation for a repo this instance never installed. The fix adds a single `if (!repo.isInstalled) continue;` guard and explicitly preserves the existing non-filtering on isRegistered (correctly avoiding the chicken-and-egg deadlock documented in the comment). The new regression test seeds a registry-only row (is_installed=0, is_registered=1) with an opted-in manifest and asserts exclusion, directly exercising the new branch on the real code path.

Blockers

Nits — 5 non-blocking
  • The `seedRegistryOnlyRepo` test helper in test/unit/gittensor-wire.test.ts duplicates the raw-SQL-insert pattern of `seedRegisteredRepo` almost verbatim aside from the is_installed/is_registered values; consider a single helper parametrized by both flags to reduce duplication.
  • Consider whether `listRepositories` could be filtered at the query layer (e.g. `WHERE is_installed = 1`) instead of post-filtering in the loop, which would also reduce unnecessary manifest-load attempts for excluded repos, though the current approach is correct as-is.
  • nit: test/unit/gittensor-wire.test.ts:105 should also cover a mixed set with one installed opted-in repo plus one registry-only opted-in repo, so the regression proves the new filter excludes only the registry-only row rather than accidentally changing the positive path.
  • test/unit/gittensor-wire.test.ts:105: extend the regression with an installed opted-in repo and expect `new Set(["owner/installed"])` after also seeding `attacker/external`.
  • PR description: add `Closes #NNNN` or `Refs #NNNN` for the eligible repo issue that authorized this self-host boundary fix.

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: 46 registered-repo PR(s), 38 merged, 416 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 46 PR(s), 416 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
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: 46 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.
  • 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.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

🟩 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

@gittensory-orb gittensory-orb Bot added the manual-review Gittensor contributor context label Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant