Skip to content

Commit 1b68885

Browse files
authored
Merge pull request #819 from sparrowapp-dev/revert-804-SPRW-1952-vulnerability-user-team-enumeration-via-chained-idor
Revert "fix: SPRW-1951 & 1952 [Vulnerability] Sensitive Information Disclosure via Public Workspace API"
2 parents f4a20d4 + 875f119 commit 1b68885

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

src/modules/identity/services/team.service.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,6 @@ export class TeamService {
430430
userId: string,
431431
currentUser: DecodedUserObject,
432432
): Promise<WithId<Team>[]> {
433-
if (currentUser?._id.toString() !== userId.toString()) {
434-
throw new BadRequestException(
435-
"You are not authorised to fetch the team details of this particular user",
436-
);
437-
}
438433
const user = await this.userRepository.getUserById(userId, currentUser);
439434
if (!user) {
440435
throw new BadRequestException(

src/modules/workspace/services/workspace.service.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ export class WorkspaceService {
9494
userId: string,
9595
currentUser: DecodedUserObject,
9696
): Promise<Workspace[]> {
97-
if (currentUser?._id.toString() !== userId.toString()) {
98-
throw new BadRequestException(
99-
"You are not authorised to fetch the workspace details of this particular user",
100-
);
101-
}
10297
const user = await this.userRepository.getUserById(userId, currentUser);
10398
if (!user) {
10499
throw new BadRequestException(
@@ -262,7 +257,7 @@ export class WorkspaceService {
262257
}
263258
throw new BadRequestException("You don't have access of this Workspace");
264259
}
265-
260+
266261
/**
267262
* Creates a new workspace in the database
268263
* @param {CreateOrUpdateWorkspaceDto} workspaceData
@@ -286,16 +281,12 @@ export class WorkspaceService {
286281
}
287282
const planData = teamData?.plan;
288283
const uuid = new ObjectId();
289-
const ws = {
284+
const ws = {
290285
id: uuid,
291286
name: workspaceData.name,
292287
};
293-
const res = await this.teamRepository.updateTeamWorkspaceCountById(
294-
teamId,
295-
planData,
296-
ws,
297-
);
298-
if (!res) {
288+
const res = await this.teamRepository.updateTeamWorkspaceCountById(teamId, planData, ws);
289+
if(!res){
299290
throw new ForbiddenException("Plan limit reached");
300291
}
301292
const createEnvironmentDto: CreateEnvironmentDto = {

0 commit comments

Comments
 (0)