Commit 9c51067
committed
Fix admin auth bypass: enforce GitHub org-admin checks in all environments
Previously, authorizeOrgAccess() skipped all admin authorization in
non-production environments, allowing any authenticated user to perform
admin actions (update CLAs, toggle activation, manage bypass lists) and
read admin panel data for any organization.
Changes:
- Remove blanket NODE_ENV !== "production" bypass from authorizeOrgAccess
- Add scoped DB-admin fallback for non-production (only the designated
installer passes, not any authenticated user), consistent with
filterInstalledOrganizationsForAdmin
- Restrict GET /api/sign/[orgSlug] to return only signing-relevant org
fields (name, slug, avatar, isActive, claText) instead of the full
org row which leaked adminUserId, installationId, etc.
- Remove installedOrgsCount from GET /api/orgs response to prevent
leaking total platform org count to non-admin users
https://claude.ai/code/session_01FxG73b4jTBhGa5CK6kyKrG1 parent 5a80a5c commit 9c51067
3 files changed
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
| |||
0 commit comments