Commit cbcdf76
Improve org access control and API response filtering (#8)
* 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_01FxG73b4jTBhGa5CK6kyKrG
* Scope installedOrgsCount to user's authorized orgs
Return the count of orgs the user is admin of rather than removing
the field entirely, so the client can distinguish "no orgs installed"
from "installed but no admin access".
https://claude.ai/code/session_01FxG73b4jTBhGa5CK6kyKrG
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 50bd8ca commit cbcdf76
3 files changed
Lines changed: 17 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| 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