Skip to content

Commit

Permalink
[server] Fix permission check for logs streaming (#20423)
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek authored Dec 5, 2024
1 parent 10c44d3 commit 2db6b3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions components/server/src/prebuilds/prebuild-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,10 @@ export class PrebuildManager {
onLog: (chunk: Uint8Array) => Promise<void>,
): Promise<{ taskUrl: string } | undefined> {
const prebuild = await this.getPrebuild({}, userId, prebuildId);
const organizationId = prebuild?.info.teamId;
if (!prebuild || !organizationId) {
if (!prebuild) {
throw new ApplicationError(ErrorCodes.PRECONDITION_FAILED, "prebuild workspace not found");
}
await this.auth.checkPermissionOnProject(userId, "read_prebuild", organizationId);
await this.auth.checkPermissionOnProject(userId, "read_prebuild", prebuild.info.projectId);

const instance = await this.workspaceService.getCurrentInstance(userId, prebuild.workspace.id, {
skipPermissionCheck: true,
Expand Down
2 changes: 2 additions & 0 deletions components/server/src/projects/projects-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,10 @@ export class ProjectsService {
partialProject.settings.prebuilds.triggerStrategy = "activity-based";
}
}

return this.projectDB.updateProject(partialProject);
}

private async checkProjectSettings(userId: string, settings?: PartialProject["settings"]) {
if (!settings) {
return;
Expand Down
2 changes: 1 addition & 1 deletion components/server/src/workspace/headless-log-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class HeadlessLogService {
}
}

// we were unable to get a repsonse from supervisor - let's try content service next
// we were unable to get a response from supervisor - let's try content service next
return await this.contentServiceListLogs(wsi, ownerId);
}

Expand Down

0 comments on commit 2db6b3f

Please sign in to comment.