fix(orb): bind enrollment admin checks to immutable GitHub account ids#1393
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 #1393 +/- ##
==========================================
- Coverage 95.43% 95.42% -0.01%
==========================================
Files 202 202
Lines 21743 21743
Branches 7856 7857 +1
==========================================
- Hits 20750 20749 -1
Misses 416 416
- Partials 577 578 +1
🚀 New features to boost your workflow:
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | d373376 | Commit Preview URL Branch Preview URL |
Jun 27 2026, 01:03 AM |
e557966 to
780127d
Compare
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary Nits (5)
Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. This PR hardens the OAuth self-enrollment admin gate by binding authorization to GitHub's immutable numeric account ids instead of mutable login strings, closing a privilege-escalation path where a recycled or renamed login could authorize enrollment of a victim's installation. The migration, persistence layer, `verifyInstallationAdmin` signature, and all call sites are updated consistently. For User installs both login (case-insensitive) and id must match; for Org installs the membership API's `organization.id` is validated against the stored `account_id`, so a stale `account_login` in the DB cannot be exploited even after a rename. Existing rows with `account_id IS NULL` (pre-migration) safely fail the `accountId === null` guard, defaulting to deny until a webhook re-sync or backfill populates the column. 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.
|
…enrollment-login-vulnerability
Motivation
account_logincould be abused if a GitHub account/org renames or an attacker reclaims the old login.installation_id.Description
migrations/0070_orb_github_installation_account_id.sqlto persistaccount_idinorb_github_installations.account_idfrom webhook upserts and the App-installation backfill by wiring it throughsrc/orb/installations.tsandsrc/orb/app-auth.ts.src/orb/oauth.tsby threading the OAuthuser.idand storedaccount_idintoverifyInstallationAdminand requiring id-equality for User installs and matchingorganization.idfor Org installs.account_idin the OAuth enrollment flow and pass the authenticateduser.idinto the authorization check, and add a regression test that verifies stale-login reuse is refused; update related tests to exercise the new branches.Testing
npx vitest run test/integration/orb-oauth.test.ts test/integration/orb-installations.test.ts test/unit/orb-app-auth.test.tsand all specified tests passed.npm run db:migrations:checkwhich passed andnpm run typecheckwhich passed with no type errors.npm run test:cibut the run failed during coverage generation withTypeError: jsTokens is not a functionfrom the coverage tooling (failure appears unrelated to the orb change and blocked full CI completion).npm audit --audit-level=moderatecould not complete in this environment (registry audit returned 403).Codex Task