Summary
The background-worker source endpoint authenticates callers and checks project membership, but does not enforce the caller's deployment-read permission before returning worker source code and task configuration.
An organization member using a personal access token with a custom role that denies deployment reads may therefore retrieve deployed worker source through this endpoint.
Root cause
apps/webapp/app/routes/api.v1.projects.$projectRef.background-workers.$envSlug.$version.ts calls authenticateRequest and authenticatedEnvironmentForAuthentication, then loads the worker and returns decompressed file contents and task configuration. It does not call authorizePatEnvironmentAccess.
The sibling route api.v1.projects.$projectRef.$env.workers.$tagName.ts enforces this permission using authorizePatEnvironmentAccess with resource deployments, action read, and the resolved organization, project, and environment type.
Project membership and environment resolution do not replace this permission check.
Impact and prerequisites
A successful attack discloses deployed worker source code and task configuration. No modification of source or deployment state has been established.
The attacker needs:
- Membership in the target project.
- A personal access token associated with a custom role that denies deployment reads for the target environment.
- The project reference, environment identifier, and worker version.
Built-in roles that already permit deployment reads are not affected by this permission bypass. Default self-hosted installations use permissive RBAC and do not enforce the restricted-role boundary described here.
Summary
The background-worker source endpoint authenticates callers and checks project membership, but does not enforce the caller's deployment-read permission before returning worker source code and task configuration.
An organization member using a personal access token with a custom role that denies deployment reads may therefore retrieve deployed worker source through this endpoint.
Root cause
apps/webapp/app/routes/api.v1.projects.$projectRef.background-workers.$envSlug.$version.tscallsauthenticateRequestandauthenticatedEnvironmentForAuthentication, then loads the worker and returns decompressed file contents and task configuration. It does not callauthorizePatEnvironmentAccess.The sibling route
api.v1.projects.$projectRef.$env.workers.$tagName.tsenforces this permission usingauthorizePatEnvironmentAccesswith resourcedeployments, actionread, and the resolved organization, project, and environment type.Project membership and environment resolution do not replace this permission check.
Impact and prerequisites
A successful attack discloses deployed worker source code and task configuration. No modification of source or deployment state has been established.
The attacker needs:
Built-in roles that already permit deployment reads are not affected by this permission bypass. Default self-hosted installations use permissive RBAC and do not enforce the restricted-role boundary described here.