Skip to content

fix(review): keep grounding bound to repo allowlist - #4137

Merged
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-grounding-allowlist-bypass
Jul 8, 2026
Merged

fix(review): keep grounding bound to repo allowlist#4137
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-grounding-allowlist-bypass

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • A repo-controlled features.grounding: true could previously bypass the operator GITTENSORY_REVIEW_REPOS allowlist and enable grounding, which fetches full post-change file contents into AI prompts and is a sensitive operator-policy boundary.
  • The change restores operator control so grounding cannot be enabled by a repository manifest when the repo is not allowlisted, while preserving the ability for allowlisted repos to opt out per-repo.

Description

  • Update resolveConvergedFeature in src/review/feature-activation.ts to treat grounding asymmetrically so grounding is only active when the repo is allowlisted and the manifest does not explicitly disable it.
  • Add explanatory comments documenting the special-case behavior for grounding alongside the existing safety exception.
  • Add regression tests in test/unit/feature-activation.test.ts that assert a manifest cannot force grounding ON outside GITTENSORY_REVIEW_REPOS and that allowlisted repos retain default-on and per-repo force-off semantics.
  • Files changed: src/review/feature-activation.ts, test/unit/feature-activation.test.ts.

Testing

  • Ran the targeted unit tests with npm test -- --run test/unit/feature-activation.test.ts, and the suite passed (14 tests).
  • Ran TypeScript typecheck with npm run typecheck, which succeeded.
  • Attempted the full local gate npm run test:ci; it progressed but stopped on an existing drift in cf-typegen (worker-configuration.d.ts is stale; run npm run cf-typegen) and npm audit --audit-level=moderate failed due to the registry audit endpoint returning 403 Forbidden.

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.68%. Comparing base (470d5fe) to head (537e3fd).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4137   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files         384      384           
  Lines       36007    36009    +2     
  Branches    13213    13214    +1     
=======================================
+ Hits        33733    33735    +2     
  Misses       1618     1618           
  Partials      656      656           
Files with missing lines Coverage Δ
src/review/feature-activation.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.

@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 07:36:51 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 closes a real allowlist-bypass hole: previously `if (override !== null) return override` let a repo-controlled `.gittensory.yml` force `grounding: true` and thus have gittensory fetch full post-change file contents into AI prompts even for a repo the operator never added to GITTENSORY_REVIEW_REPOS. The fix carves out grounding as an asymmetric case (`allowlisted && override !== false`) mirroring the existing `safety` force-on-only exception, so a repo override can only turn grounding OFF, never ON outside the allowlist. The new tests exercise `resolveConvergedFeature` directly (the real production code path, not a fabricated payload) and cover the exact bypass scenario plus the allowlisted default-on/force-off cases.

Nits — 5 non-blocking
  • src/review/feature-activation.ts:43-44 now has two hand-rolled per-feature exceptions (safety, grounding) inline in the if/else chain — if a third asymmetric feature shows up, consider a small per-feature policy table (e.g. `{ forceOnOnly: ['safety'], forceOffOnly: ['grounding'] }`) instead of growing this chain further.
  • Unlike the `safety` exception, which links `fix(review): features.safety is per-repo disableable via .gittensory.yml even when the operator enabled it globally #2269` in both the file-header comment and the docstring, the new `grounding` comment doesn't reference a tracking issue for this bypass — worth a pointer for future readers tracing why this asymmetry exists.
  • No PR description mentions a linked issue number for this fix; given the issue-scope convention for this repo, it'd help to confirm/attach the tracking issue even though this is clearly a legitimate security fix rather than a feature.
  • Consider adding one more explicit test case for grounding: kill-switch off + allowlisted + override true, to make the 'kill-switch always wins' guarantee explicit for grounding specifically rather than relying on the generic per-key loop test in the file.
  • If other converged features gain similar asymmetric semantics later, extract the per-feature override policy into data (as noted in nits) so `resolveConvergedFeature` doesn't keep accreting `if (feature === ...)` branches.

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: 52 registered-repo PR(s), 43 merged, 496 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 52 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: 52 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 742b365 into main Jul 8, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-grounding-allowlist-bypass branch July 8, 2026 07:38
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