Skip to content

fix(miner): add optional token verification to init - #5417

Closed
taillred wants to merge 1 commit into
JSONbored:mainfrom
taillred:fix/miner-init-verify-token
Closed

fix(miner): add optional token verification to init#5417
taillred wants to merge 1 commit into
JSONbored:mainfrom
taillred:fix/miner-init-verify-token

Conversation

@taillred

Copy link
Copy Markdown
Contributor

Summary

Add an opt-in --verify-token flag to gittensory-miner init that makes one authenticated GitHub API call, reports the returned scopes on success, and fails fast on invalid or under-scoped tokens. Default init behavior is unchanged when the flag is omitted.

Closes #5171.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (Closes #5171).

Validation

  • git diff --check
  • node --check packages/gittensory-miner/bin/gittensory-miner.js
  • node --check packages/gittensory-miner/lib/laptop-init.js
  • node --check packages/gittensory-miner/lib/cli.js
  • Manual Node validation of the no-flag, success, invalid-token, and JSON output paths
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate

If any required check was skipped, explain why:

  • The workspace in this environment does not have the repo dev dependencies installed, so Vitest/TypeScript/CLI tooling could not be bootstrapped here. I validated the changed runtime paths directly with Node instead.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.

Notes

  • doctor remains untouched and still makes no network calls.
  • init only performs a GitHub request when --verify-token is passed.

@taillred
taillred requested a review from JSONbored as a code owner July 12, 2026 17:49
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2347 1 2346 0
View the top 1 failed test(s) by shortest run time
test/unit/miner-init-verify-token.test.ts > verifyGithubToken > rejects a token when GitHub reports only non-repository scopes
Stack Traces | 0.0216s run time
AssertionError: expected 'GITHUB_TOKEN is valid, but GitHub rep…' to contain 'missing repository access'

Expected: "missing repository access"
Received: "GITHUB_TOKEN is valid, but GitHub reported only read:org; reissue it with repo access for miner setup."

 ❯ test/unit/miner-init-verify-token.test.ts:75:27

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 12, 2026
@loopover-orb

loopover-orb Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - fixes required

Review updated: 2026-07-12 17:54:21 UTC

8 files · no blockers · readiness 100/100 · CI failing · blocked

🛑 Suggested Action - Fix Blockers

  • AI review already in progress for this PR head: Another Gittensory pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another Gittensory pass. Gittensory is holding this PR for manual review until that pass completes.

Nits — 1 non-blocking
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.

CI checks failing

  • validate
  • validate-tests (3)
  • validate-code
Signal Result Evidence
Code review ✅ No blockers No AI review summary
Linked issue ✅ Linked #5171
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 53 registered-repo PR(s), 34 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor luckydicer; Gittensor profile; 53 PR(s), 1 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: luckydicer
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 53 PR(s), 1 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat <question> 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

@loopover-orb

loopover-orb Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (3), validate-code)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

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

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an opt-in gittensory-miner init --verify-token flag to validate GITHUB_TOKEN scopes via a single API call

1 participant