feat(api): /v1/extension/* contributor-context endpoints + miner auth scope - #723
Conversation
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 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. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 5 changed file(s) — two independent AI reviewers. Changed files: Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · No blocking issues spotted. |
f2ad7ed to
666cb3e
Compare
… scope Carves out the contributor (miner) backend of the extension overlay (JSONbored#556): a new extension:contributor_context auth scope minted for non-maintainer sign-ins, strictly self-only (canSessionAccessPath allowlist + requireContributorAccess), and three redaction-checked endpoints under /v1/extension/contributors/<self>/*: issue-fit, own-PR pr-status, and issue-list badges. Every payload is public-safe and returns the private readiness/fit score as a BAND, never a raw number. Fixes JSONbored#556 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
666cb3e to
2f12928
Compare
JSONbored
left a comment
There was a problem hiding this comment.
PR #723 — feat(api): /v1/extension/* contributor-context endpoints + miner auth scope
Author: oktofeesh1 | CI: ❌ validate FAIL | Status: Concerns (auth design is sound)
ACTION: REQUEST CHANGES
Highlights:
- Auth scoping careful and correct: new extension:contributor_context scope is strictly self-only; canSessionAccessPath allowlists only /v1/extension/contributors//*; every handler calls requireContributorAccess; pr-status self-checks PR authorship (cross-login → 403). Cannot reach maintainer/control-panel paths. TIGHTENS the boundary.
- Public/private respected: scores as bands only (strong/developing/early), no score/total/max keys; redactExtensionText scrubs wallet/hotkey/reward/payout/trust. Integration tests assert band-not-number, forbidden-term absence, cross-login 403.
- Linked to #556; backend-only, no UI.
Change requests / reasons:
- CI validate is red — must be green before merge. Root cause is the repo-wide npm audit failure (js-yaml/tar/ws) inherited from main, NOT this PR's code. Clears once the audit fix lands and the branch rebases.
- mergeable_state: blocked — rebase onto a main that includes the audit fix.
- Confirm no <97% coverage regression given the large new surface (verify in the green run).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #723 +/- ##
==========================================
+ Coverage 96.68% 96.69% +0.01%
==========================================
Files 93 94 +1
Lines 13771 13845 +74
Branches 5017 5050 +33
==========================================
+ Hits 13314 13388 +74
Misses 88 88
Partials 369 369 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… patch (JSONbored#556) Raises patch coverage on the JSONbored#556 contributor-context endpoints to 100%, so codecov/patch and codecov/project pass again: - issue-fit: an unlinked open issue now surfaces as a real opportunity, covering the eligible-true return + the opportunity find callback; a cross-login request covers the self-only 403 guard. - pr-status: a contributor's own bodyless PR covers the body-defaulting path; an authorless PR covers the authorLogin-defaulting path of the self-only PR guard. - issueQualityMap is exposed via __routesInternals and unit-tested for both the report-present and absent (defensive, route-unreachable) branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
JSONbored
left a comment
There was a problem hiding this comment.
PR #723 — feat(api): /v1/extension/* contributor-context endpoints + miner auth scope
Verdict: MERGE
Resolves issue #556: FULLY
CI: All green (validate, test x2, lint, workers, ui, security, Superagent Security Scan = success, codecov). gittensory/Context neutral.
Highlights:
- Adds extension:contributor_context scope, minted only for non-maintainer sign-ins (maintainers keep extension:pull_context), keyed off loadControlPanelRoleSummary as the issue requires.
- Strict self-only enforcement layered correctly: coarse canSessionAccessPath allowlist + per-handler requireContributorAccess (actor === login) + extra self-check on PR authorship; contributor token blocked from re-minting sessions and /v1/app/*.
- All three endpoints return public-safe payloads; readiness emitted as bands (strong/developing/early, met/partial/unmet) — no score/total/max keys; defense-in-depth redactExtensionText re-filters every free-form string.
- Excellent coverage: unit (bands, redaction, zero-max, missing issue number) + integration (scope minting, cross-login 403, isolation vs maintainer path, 400/403/404, band-not-number, forbidden-term assertions).
Concerns / required changes:
- None. No public/private leakage; reuses existing builders without duplicating scoring logic.
Completeness vs issue: Implements the scope, self-only allowlist, and all redaction-checked endpoints with score-as-band, each covered by tests mirroring existing extension route tests. Fully satisfies #556.
Fixes #556.
Carves out the non-visual contributor (miner) backend of the extension overlay so the rebuilt extension (#534) can focus on rendering. No UI.
What this adds
New auth scope —
extension:contributor_contextPOST /v1/auth/extension/session(maintainers still getextension:pull_context). The role branch keys offloadControlPanelRoleSummary.canSessionAccessPathallowlist only lets the scope reach/v1/extension/contributors/<login>/*, and every handler then enforcesrequireContributorAccess(actor === login). A miner token can read only its own data.Three redaction-checked endpoints under
/v1/extension/contributors/:login/:GET …/issue-fit?owner=&repo=&issueNumber=— "is this issue a good one for me?" → fit band (good/caution/hold), multiplier tier, availability, reasons. ReusesbuildContributorOpportunities.GET …/pr-status?owner=&repo=&pullNumber=— the contributor's own PR readiness as a band (+ per-component met/partial/unmet, review status). ReusesbuildPreflightResult+buildPublicReadinessScore. Also self-checks PR authorship.GET …/issue-badges?owner=&repo=— per-issue fit badges for an issue-list overlay.Public/private boundary
redactExtensionText) and the score is returned as a band, never a raw number — noscore/total/maxkeys, and no reward/wallet/key/trust-score terms can leak (server-side authoritative).Tests
test/unit/extension-contributor-context.test.ts— bands, redaction, band-not-number, edge cases.test/integration/api.test.ts— scope minting for non-maintainers, self-only allowlist + cross-login 403, scope isolation (contributor scope can't reach the maintainer pull-context path), full success paths, validation 400s, 403/404 paths, forbidden-term redaction.npm run test:cigreen; 97%+ branch & function coverage.🤖 Generated with Claude Code