Skip to content

Commit 2db6b3f

Browse files
[server] Fix permission check for logs streaming (#20423)
1 parent 10c44d3 commit 2db6b3f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

components/server/src/prebuilds/prebuild-manager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,10 @@ export class PrebuildManager {
677677
onLog: (chunk: Uint8Array) => Promise<void>,
678678
): Promise<{ taskUrl: string } | undefined> {
679679
const prebuild = await this.getPrebuild({}, userId, prebuildId);
680-
const organizationId = prebuild?.info.teamId;
681-
if (!prebuild || !organizationId) {
680+
if (!prebuild) {
682681
throw new ApplicationError(ErrorCodes.PRECONDITION_FAILED, "prebuild workspace not found");
683682
}
684-
await this.auth.checkPermissionOnProject(userId, "read_prebuild", organizationId);
683+
await this.auth.checkPermissionOnProject(userId, "read_prebuild", prebuild.info.projectId);
685684

686685
const instance = await this.workspaceService.getCurrentInstance(userId, prebuild.workspace.id, {
687686
skipPermissionCheck: true,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,10 @@ export class ProjectsService {
447447
partialProject.settings.prebuilds.triggerStrategy = "activity-based";
448448
}
449449
}
450+
450451
return this.projectDB.updateProject(partialProject);
451452
}
453+
452454
private async checkProjectSettings(userId: string, settings?: PartialProject["settings"]) {
453455
if (!settings) {
454456
return;

components/server/src/workspace/headless-log-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class HeadlessLogService {
102102
}
103103
}
104104

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

0 commit comments

Comments
 (0)