Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: patch authorization bypass vulnerabilities across project and org endpoints

Blue Mouse244158939856
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.ts
index bca3c38af..af6f0e60a 100644
--- a/backend/apps/cloud/src/analytics/analytics.controller.ts
+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts
@@ -1021,6 +1021,7 @@ export class AnalyticsController {
}
@Get('hb')
+ @Auth(true, true)
async getHeartBeatStats(
@Query() data: GetHeartbeatStatsDto,
@CurrentUserId() uid: string,
diff --git a/backend/apps/cloud/src/organisation/organisation.service.ts b/backend/apps/cloud/src/organisation/organisation.service.ts
index e105d20d7..15a5bcaf2 100644
--- a/backend/apps/cloud/src/organisation/organisation.service.ts
+++ b/backend/apps/cloud/src/organisation/organisation.service.ts
@@ -111,7 +111,11 @@ export class OrganisationService {
(member) => member.user?.id === userId,
)
- if (!membership || membership.role === OrganisationRole.viewer) {
+ if (
+ !membership ||
+ !membership.confirmed ||
+ membership.role === OrganisationRole.viewer
+ ) {
throw new ForbiddenException(
'You do not have permission to manage this organisation',
)
@@ -142,6 +146,7 @@ export class OrganisationService {
organisation: { id: organisationId },
role: OrganisationRole.owner,
user: { id: userId },
+ confirmed: true,
},
})
diff --git a/backend/apps/cloud/src/project/project.controller.ts b/backend/apps/cloud/src/project/project.controller.ts
index 979259b84..e747db54c 100644
--- a/backend/apps/cloud/src/project/project.controller.ts
+++ b/backend/apps/cloud/src/project/project.controller.ts
@@ -913,6 +913,13 @@ export class ProjectController {
const project = await this.projectService.getFullProject(
addProjectDTO.projectId,
)
+
+ if (_isEmpty(project)) {
+ throw new NotFoundException(
+ `Project with ID ${addProjectDTO.projectId} does not exist`,
+ )
+ }
+
this.projectService.allowedToManage(project, uid)
return this.projectService.addProjectToOrganisation(
@@ -949,6 +956,14 @@ export class ProjectController {
this.organisationService.validateManageAccess(organisation, uid)
+ const project = await this.projectService.getFullProject(projectId)
+
+ if (_isEmpty(project)) {
+ throw new NotFoundException(`Project with ID ${projectId} does not exist`)
+ }
+
+ this.projectService.allowedToManage(project, uid)
+
await this.projectService.removeProjectFromOrganisation(
organisation.id,
projectId,
@@ -1872,6 +1887,14 @@ export class ProjectController {
this.projectService.allowedToManage(project, uid)
+ const share = _find(project.share, (s) => s.id === shareId)
+
+ if (!share) {
+ throw new NotFoundException(
+ `Share with ID ${shareId} does not exist on project ${pid}`,
+ )
+ }
+
await deleteProjectRedis(pid)
await this.projectService.deleteShare(shareId)
}