fix(github): drive public repo-stats allowlist from env instead of a hardcoded repo#4662
Conversation
…hardcoded repo (#4612) GET /v1/public/github/repos/:owner/:repo/stats hard-rejected every repo except a literal jsonbored/gittensory, even though the route is generically parameterized. Replace the two constants with PUBLIC_REPO_STATS_ALLOWLIST, a comma-separated owner/repo allowlist mirroring GITTENSORY_PUBLIC_STATS_REPOS's shape; empty/unset allows any syntactically-valid repo, so a self-hoster's own fork works without code changes.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | b6fbe52 | Commit Preview URL Branch Preview URL |
Jul 10 2026, 10:27 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4662 +/- ##
=======================================
Coverage 94.12% 94.12%
=======================================
Files 434 434
Lines 38496 38501 +5
Branches 14038 14040 +2
=======================================
+ Hits 36233 36238 +5
Misses 1604 1604
Partials 659 659
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-10 10:55:39 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 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.
|
Summary
GET /v1/public/github/repos/:owner/:repo/statslooked like a generic, per-repo route but hard-rejected every repo except a literaljsonbored/gittensoryvia two hardcoded constants (PUBLIC_REPO_STATS_OWNER/PUBLIC_REPO_STATS_REPO). A self-hoster's own fork got a hard 400invalid_github_repoon their own repo.PUBLIC_REPO_STATS_ALLOWLIST, a comma-separatedowner/repoallowlist env var mirroringGITTENSORY_PUBLIC_STATS_REPOS's parsing shape insrc/review/public-stats.ts. Empty/unset allows any syntactically-validowner/repo(matching the siblingbadge.svgroute's any-repo behavior); setting it restricts the endpoint to specific repos.apps/gittensory-ui/public/openapi.jsonaccordingly.Closes #4612
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
npx vitest run test/integration/api.test.ts test/unit/openapi.test.ts test/unit/auth.test.ts --coveragescoped to the changed source files (src/github/public.ts,src/openapi/spec.ts) instead of the full unshardedtest:coverage; every changed line/branch in the diff shows nonzero hit counts on both sides.actionlint/test:workers/build:mcp/test:mcp-pack/ui:lint/ui:typecheck/ui:buildare untouched by this change (no workflow, worker-pool, MCP, or UI source files changed) and are left to CI.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
Not applicable — backend-only change, no visible UI surface touched.
Notes
/v1/public/github/repos/JSONbored/gittensory/stats) is unchanged: it is covered by the "allow any" default (noPUBLIC_REPO_STATS_ALLOWLISTset), and existing tests for that repo still pass unmodified.rejects non-allowlisted public GitHub repo stats paths before calling GitHub) asserted the old hardcoded-repo behavior with no allowlist configured; it is replaced by two tests that cover the new semantics explicitly: allow-any-when-unset, and reject-when-configured (including allowlist parsing of whitespace/casing/empty entries).