feat(orb): add an AMS-facing secret type to the generalized broker - #8111
Conversation
…7674) Adds ORB_SECRET_TYPE_AMS_GITHUB_TOKEN to src/orb/broker.ts, ratified on #4941: hosted AMS reuses ORB's installation-based broker rather than a parallel identity system. Mechanically identical to ORB_SECRET_TYPE_GITHUB_TOKEN -- a GitHub App installation token's permissions come from the App and what the installer granted, not from anything the broker's caller specifies, so there is no real behavioral difference to build. brokerOrbToken's eligibility check now accepts either value, routing both through the exact same mint/cache/ install-eligibility flow; the distinct value exists purely so an enrollment row records which product's container it was issued for. Deliberately distinct from the self-host session-based GitHub auth packages/loopover-miner/lib/github-token-resolution.ts uses (a human's own OAuth token via /v1/auth/github/token, from a loopover-mcp login) -- that flow authenticates an interactive human tool as themselves; this one authorizes a headless hosted container as the installed App, the same reason ORB's own broker exists at all. The two are not duplicative: one models a human identity, the other a machine service identity. Scope is deliberately narrow, mirroring the #8064/#8066 split: this adds only the broker's capability to mint this type. It does not wire up a way for a real caller to request it at issuance time (POST /v1/internal/orb/enrollments and oauth.ts's self-enrollment landing page both still hardcode github_token) -- that's a follow-up once a real hosted-AMS consumer exists to call it. Tests mirror the existing github_token coverage (mint, cache, install- eligibility re-check) for the new type, plus a regression test confirming a genuinely unrecognized secret type is still rejected.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8111 +/- ##
==========================================
- Coverage 92.01% 89.55% -2.46%
==========================================
Files 754 98 -656
Lines 77188 22645 -54543
Branches 23335 3882 -19453
==========================================
- Hits 71021 20279 -50742
+ Misses 5061 2187 -2874
+ Partials 1106 179 -927
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-22 23:01:23 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Implements #7674, ratified on #4941: hosted AMS reuses ORB's installation-based broker rather than a parallel identity system.
ORB_SECRET_TYPE_AMS_GITHUB_TOKEN: mechanically identical toORB_SECRET_TYPE_GITHUB_TOKEN— a GitHub App installation token's permissions come from the App and what the installer granted, not from anything the broker's caller specifies, so there's no real behavioral difference to build here.brokerOrbToken's eligibility check now accepts either value, routing both through the exact same mint/cache/install-eligibility flow. The distinct value exists purely so an enrollment row records which product's container it was issued for (bookkeeping/audit).packages/loopover-miner/lib/github-token-resolution.tsuses (a human's own OAuth token via/v1/auth/github/token, from aloopover-mcp login) — that flow authenticates an interactive human tool as themselves; this one authorizes a headless hosted container as the installed App, the same reason ORB's own broker exists at all. These are not duplicative auth systems — one models a human identity, the other a machine service identity — confirmed against Design an auth/identity layer for AMS #4941's own ratified resolution before building anything.Scope boundary
Mirroring the #8064/#8066 split: this adds only the broker's capability to mint this type. It does not wire up a way for a real caller to request it at issuance time —
POST /v1/internal/orb/enrollmentsandoauth.ts's self-enrollment landing page both still hardcodegithub_token. That's a natural follow-up once there's an actual hosted-AMS consumer ready to call it.Test plan
npx tsc --noEmitcleannpx vitest run test/integration/orb-broker.test.ts— 42/42 passingnpx vitest run— full suite, 1092 files / 20392 tests, 0 failuressrc/orb/broker.ts— 100% statements/functions/lines; the one branch gap (readCachedOrbToken'sentry.permissions ?? {}) is pre-existing, untouched codenpx tsx scripts/check-migrations.ts/check-schema-drift.ts— no schema changes in this PR, both cleannpx tsx scripts/write-ui-openapi.ts --checkclean (internal-only routes, not part of the public OpenAPI surface)npm audit --audit-level=moderate— pre-existing findings only, no dependency changesCloses #7674