GHSA-633X-9X77-77GF
D - Channel RBAC deny overrides bypassed by bundle promotion API
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-633X-9X77-77GF divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Channel RBAC deny overrides bypassed by bundle promotion API
Summary
Capgo's channel RBAC override model lets admins set per-channel allow/deny rules for `channel.promote_bundle`, but the API-key bundle promotion endpoint checks that permission at app scope only. Because `channel_id` is omitted from the permission check, `rbac_check_permission_direct` never enables channel-scope override evaluation and a principal with app-level `channel.promote_bundle` can promote a bundle to a channel where that principal is explicitly denied.
This is a source-local finding against `Cap-go/capgo` commit `de66fa51e7ff2f50283cc1455c3d80ab3eb0ae43`. No live Capgo, Supabase, R2, TUS, or customer systems were tested.
Affected Components
- `supabase/functions/_backend/public/bundle/index.ts:28-31`: `PUT /bundle` is exposed to `all`/`write` API keys and dispatches to `setChannel`.
- `supabase/functions/_backend/public/bundle/set_channel.ts:25-28`: `setChannel` authorizes with `checkPermission(c, 'channel.promote_bundle', { appId: body.app_id })`, omitting `body.channel_id`.
- `supabase/functions/_backend/public/bundle/set_channel.ts:55-66`: the target channel is only validated after authorization.
- `supabase/functions/_backend/public/bundle/set_channel.ts:89-97`: the handler updates `public.channels.version` for the supplied `channel_id`.
- `supabase/functions/_backend/utils/rbac.ts:226-269`: omitted scope fields are passed as SQL `NULL`, so omitting `channelId` calls `rbac_check_permission_direct(..., p_channel_id := NULL, ...)`.
- `supabase/migrations/20260427144331_restore_rbac_apikey_mismatch_and_bindings_priority.sql:52-54`: channel override evaluation is gated by `p_channel_id IS NOT NULL AND p_permission_key LIKE 'channel.%'`.
- `supabase/migrations/20260427144331_restore_rbac_apikey_mismatch_and_bindings_priority.sql:260-300`: user and group channel overrides are applied only when that channel-scope gate is true.
- `supabase/migrations/20260427144331_restore_rbac_apikey_mismatch_and_bindings_priority.sql:314-325`: API-key channel overrides are also applied only when that channel-scope gate is true.
Security Boundary
The repository treats channel permission overrides as an intended RBAC boundary:
- `supabase/migrations/20260204181424_add_channel_permission_overrides.sql:20-24` documents `channel_permission_overrides` as delta-only overrides for channel-scoped permissions.
- `src/components/tables/AccessTable.vue:76-80` includes `channel.promote_bundle` in the per-channel override UI.
- `src/components/tables/AccessTable.vue:274-328` persists per-principal `allow`/`deny` rows for a specific `channel_id` and permission.
- `supabase/migrations/20251222140030_rbac_system.sql:747-752` defines `channel.promote_bundle` as channel-scoped.
- `supabase/migrations/20251222140030_rbac_system.sql:875-883` gives app developers app-level channel promotion by default; `supabase/migrations/20260204181424_add_channel_permission_overrides.sql:95-108` later extends `app_uploader` defaults with channel promotion too.
Source-Only Proof of Concept
- In an RBAC-enabled org, grant user `U` app-level `app_developer` or `app_uploader` on app `com.example.app`.
- Create channel `production` with `id = 123` and bundle version `456` under the same app.
- As an app access admin, create a deny override:
INSERT INTO public.channel_permission_overrides
(principal_type, principal_id, channel_id, permission_key, is_allowed)
VALUES
('user', '<U uuid>', 123, 'channel.promote_bundle', false);- A correct channel-scoped check should deny:
SELECT public.rbac_check_permission_direct(
'channel.promote_bundle',
'<U uuid>',
NULL,
NULL,
123,
NULL
);
-- expected: false because the channel override is evaluated- User `U` creates a write/all API key. The API-key creation endpoint accepts JWT callers and takes the requested mode from the body (`supabase/functions/_backend/public/apikey/post.ts:10-14`, `42-52`, `99-110`).
- With that key, call the bundle promotion endpoint:
PUT /bundle
capgkey: <U write key>
content-type: application/json
{
"app_id": "com.example.app",
"version_id": 456,
"channel_id": 123
}The route accepts `write` keys (`bundle/index.ts:28-31`). `setChannel` then checks `channel.promote_bundle` with `{ appId }` only (`set_channel.ts:25-28`). In SQL, `p_channel_id` is `NULL`, so `v_channel_scope` remains false and the deny override is skipped. The handler then updates `channels.version` for channel `123`.
Impact
A user or API key that is intentionally denied promotion rights on a protected channel can still deploy a bundle to that channel through the API-key promotion path. For OTA update systems, this is a high-impact authorization bypass: a restricted developer/uploader can push arbitrary web assets to production/stable devices despite an explicit per-channel deny.
This is especially relevant because the same role families that are natural uploaders can hold app-level `channel.promote_bundle`; channel overrides are the only visible control intended to block a specific production channel without removing broader app access.
Suggested Fix
Authorize the exact target channel before updating it:
if (!(await checkPermission(c, 'channel.promote_bundle', {
appId: body.app_id,
channelId: body.channel_id,
}))) {
throw simpleError('cannot_access_app', "You can't access this app", { app_id: body.app_id })
}Also audit other promotion/write paths that check channel permissions with only `appId` or that update `channels.version` through legacy app-scope RLS. In particular, frontend paths use app-scoped checks in `src/pages/app/[app].bundle.[bundle].vue:74-78` and `src/components/dashboard/DeploymentBanner.vue:97-101`; these can mislead the UI even if the backend endpoint is fixed.
Validation Notes
This packet is based on static source review only. I did not execute Capgo cloud requests, Supabase queries against a live project, R2/TUS traffic, or customer-device tests.
Reporter
Francesco Sabiu
Safety
This report is source-local only. I did not test live Capgo, Supabase, R2, TUS, customer, or device infrastructure.
---
Fix PR (merged)
Intentional fix already on main:
- https://github.com/Cap-go/capgo.app/pull/2067 (merged 2026-05-10) — backend + DB trigger + integration tests
- https://github.com/Cap-go/capgo.app/pull/2093 (merged 2026-05-10) — transaction-scoped `checkPermissionPg` with `channelId`
Re-verified 2026-08-26 on current main: `setChannel` / `PUT /bundle` and other promote paths pass `channelId`; channel deny overrides apply. Regression tests present (`bundle-set-channel-rbac.unit.test.ts`, `[PUT] /bundle RBAC channel overrides`).
Reporter: please verify on current production. Bounty/credit is due only after that verification, per Capgo bounty policy.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Estado del parche por paquete
La fuente no informa paquetes ni versiones corregidas.
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/Cap-go/capgo.app/security/advisories/GHSA-633x-9x77-77gfLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
