Skip to content

Commit a3db4f1

Browse files
authored
[server] Allow org env vars in repos that don't have projects (#20774)
Enables the use case of collaborators allowing to use projects with a private default workspace image configured on the org-level. This is enabled by the optional `enableDockerdAuthentication` that was implemented in #20586 - shortly _after_ org-level-env vars was implemented in #20538.
1 parent 51254eb commit a3db4f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/server/src/user/env-var-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ export class EnvVarService {
317317
}
318318
if (projectId) {
319319
await this.auth.checkPermissionOnProject(requestorId, "read_env_var", projectId);
320+
}
321+
if (organizationId) {
320322
await this.auth.checkPermissionOnOrganization(requestorId, "read_env_var", organizationId);
321323
}
322324

@@ -337,9 +339,7 @@ export class EnvVarService {
337339
}
338340

339341
// 2. then org env vars (if applicable)
340-
if (projectId) {
341-
// !!! Important: Only apply the org env vars if the workspace is part of a project
342-
// This is to prevent leaking org env vars to workspaces randomly started in an organization (safety feature)
342+
if (organizationId) {
343343
const orgEnvVars =
344344
(await ApplicationError.notFoundToUndefined(this.listOrgEnvVars(requestorId, organizationId))) || [];
345345
const withValues: OrgEnvVarWithValue[] = await this.orgDB.getOrgEnvironmentVariableValues(orgEnvVars);

0 commit comments

Comments
 (0)