fix(orb): cache brokered installation tokens - #1657
Conversation
|
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 #1657 +/- ##
=======================================
Coverage 95.52% 95.52%
=======================================
Files 204 204
Lines 22196 22218 +22
Branches 8025 8029 +4
=======================================
+ Hits 21202 21224 +22
Misses 415 415
Partials 579 579
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review — held for maintainer review
⏸️ Held for maintainer review — Readiness score is below the configured threshold — Address the short explicit PR panel actions, then re-run the gate. Review summary Concerns raised — review before merging
Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. The broker now reuses encrypted cached installation tokens after rechecking enrollment and installation eligibility, and falls back to minting when the cache is absent, stale, unreadable, or unavailable. The core runtime path is sound: cached tokens are not served for revoked enrollments or ineligible installations, and cache/write timestamp failures are intentionally fail-open for token exchange. The main gap is test hygiene and coverage around the actual expiry boundary and invalid cache shapes, not a functional blocker in the changed broker logic. Nits (5)
🟩 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.
|
ba4cf0b to
a6b036b
Compare
Summary
No issue because this is maintainer-side Orb broker hardening for an already shipped token-exchange path. This keeps repeated valid
/v1/orb/tokenexchanges from forcing a fresh GitHub installation token mint while the previous encrypted cache entry is still safely fresh.What changed
cached_token_jsonfromorb_enrollmentsand reuses a decryptable, non-expiring cached installation token when available.TOKEN_ENCRYPTION_SECRET.last_token_atwrites best-effort so bookkeeping failures do not fail an otherwise valid token exchange.Migration note
migrations/0081_orb_enrollment_token_cache.sqlis already on currentmainand addsorb_enrollments.cached_token_json, so this branch only needs the broker/runtime and regression-test changes.Validation
npm cinpx vitest run test/integration/orb-broker.test.tsnpm run typechecknpm run test:coveragenpm run test:cinpm audit --audit-level=moderategit diff --checknpm run db:migrations:check