Skip to content

fix(api): allow authenticated sessions to reach registration-readiness / gittensor-config-recommendation (#8654) - #8703

Closed
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-session-allowlist-readiness-8654
Closed

fix(api): allow authenticated sessions to reach registration-readiness / gittensor-config-recommendation (#8654)#8703
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-session-allowlist-readiness-8654

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Problem

Closes #8654.

src/api/routes.ts's registration-readiness and gittensor-config-recommendation route handlers have no internal auth/role check — they are advisory, any-authenticated-user lookups. The owner panel (owner-panel.tsx) calls both via useApiResource (which always sends credentials: "include") and takes a free-text repo name rather than scoping to the caller's own repos.

Neither path had a predicate in canSessionAccessPath, so a real non-operator browser session got 403 on the owner panel's only two data calls, while operators / server-to-server tokens (which bypass the allowlist) worked.

Fix — unblock only, no new restriction

Added the two missing path predicates (isRepoRegistrationReadinessPath, isRepoGittensorConfigRecommendationPath) and their allowlist entries in canSessionAccessPath, so any authenticated session may reach both routes.

This unblocks the existing intended open access; it adds no authorization restriction. Evidence the open access is intentional (not a forgotten guard):

  • The handlers carry no per-repo ownership check at all.
  • buildRegistrationReadinessResponse deliberately strips owner-private context via stripOwnerPolicyContext before returning — i.e. the payload is designed for public/any-authenticated reads.
  • The owner panel intentionally accepts an arbitrary free-text repo name.

Tests

A new test in test/unit/access-boundary.test.ts (using its existing session-cookie template) asserts a logged-in user who maintains no repo here now gets 200 (previously 403) on both routes for an arbitrary repo. Reverting the allowlist entries makes it fail. git diff --check clean.

…cal path-matchers

src/review/merge-train.ts hand-rolled its own low-signal file/dir detection that had drifted from the
canonical set its sibling files already use:

- LOW_SIGNAL_FILENAME_RE matched only package-lock.json/yarn.lock/pnpm-lock.yaml/Cargo.lock (4 names),
  so two PRs sharing only a poetry.lock, go.sum, npm-shrinkwrap.json, etc. were treated as a real
  overlap and forced into a spurious merge-train wait.
- LOW_SIGNAL_DIR_RE matched only dist/build/coverage/node_modules, missing 'out' and the vendored-code
  family (vendor/vendored/third_party/bower_components/jspm_packages).

Replace the filename regex with the canonical isLockfile() helper from path-matchers.ts (the same
dependency-free leaf utility review-diff.ts and review-grounding.ts already delegate to, covering all
24+ lockfile formats), and extend the directory regex to the canonical generated/vendored set. Two
new tests prove PRs sharing only poetry.lock/go.sum or vendor/third_party paths now decide {wait:false}
where they previously decided {wait:true}.
@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 25, 2026 23:53
@loopover-orb

loopover-orb Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

LoopOver closed this because @RealDiligent has 3 open pull requests, above this repository's configured limit of 2. Close or merge an existing one to open a new one. This is an automated maintenance action.

@loopover-orb loopover-orb Bot closed this Jul 25, 2026
@loopover-orb loopover-orb Bot added the mod:warning Gittensor contributor context label Jul 25, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

…s and gittensor-config-recommendation

src/api/routes.ts's registration-readiness and gittensor-config-recommendation route handlers carry
no per-repo ownership guard by design -- they are advisory, any-authenticated-user lookups (the owner
panel takes a free-text repo name, and buildRegistrationReadinessResponse already strips owner-private
context via stripOwnerPolicyContext before returning). But neither path had a predicate in
canSessionAccessPath, so a real non-operator browser session got 403 on the owner panel's only two
data calls, while operators/server tokens (which bypass the allowlist) worked.

Add the two missing path predicates to the session allowlist so any authenticated session may reach
them, matching the routes' existing intended open access. This unblocks the existing behavior only --
it adds no new authorization restriction (none was found to be intended: the handlers have no
per-repo check, and the readiness payload is deliberately owner-context-stripped for public reads).

Test: a session-cookie-authenticated user who maintains no repo here now gets 200 (not 403) on both
routes for an arbitrary repo, in test/unit/access-boundary.test.ts.
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.02%. Comparing base (c5cc6c4) to head (0a621fe).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8703      +/-   ##
==========================================
- Coverage   93.76%   91.02%   -2.75%     
==========================================
  Files         797       98     -699     
  Lines       79454    24920   -54534     
  Branches    24070     4666   -19404     
==========================================
- Hits        74504    22684   -51820     
+ Misses       3565     1971    -1594     
+ Partials     1385      265    -1120     
Flag Coverage Δ
backend 95.34% <100.00%> (+0.31%) ⬆️

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

Files with missing lines Coverage Δ
src/api/routes.ts 95.29% <100.00%> (+<0.01%) ⬆️
src/review/merge-train.ts 100.00% <100.00%> (ø)

... and 699 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:warning Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(orb): registration-readiness and gittensor-config-recommendation routes are unreachable from a real browser session

1 participant