Skip to content

Commit f885c5e

Browse files
committed
[server] Guard project.settings.enableDockerdAuthentication by org write_settings permission
Tool: gitpod/catfood.gitpod.cloud
1 parent 95b33e8 commit f885c5e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

components/server/src/projects/projects-service.ts

+10
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,16 @@ export class ProjectsService {
442442
throw new ApplicationError(ErrorCodes.NOT_FOUND, `Project ${partialProject.id} not found.`);
443443
}
444444

445+
// In case we are altering the "enableDockerdAuthentication": require org write_settings permission, so users
446+
// can't inadvertently share credentials an owner configured
447+
if (
448+
partialProject?.settings?.enableDockerdAuthentication !==
449+
existingProject.settings?.enableDockerdAuthentication &&
450+
partialProject?.settings?.enableDockerdAuthentication
451+
) {
452+
await this.auth.checkPermissionOnOrganization(user.id, "write_settings", existingProject.teamId);
453+
}
454+
445455
// Merge settings so that clients don't need to pass previous value all the time
446456
// (not update setting field if undefined)
447457
if (partialProject.settings) {

0 commit comments

Comments
 (0)