Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(backend:spaces,sync): enable whitelist option in ParseArrayPipe for DTO validation

johaven13fcce290826
diff --git a/backend/src/applications/spaces/spaces.controller.ts b/backend/src/applications/spaces/spaces.controller.ts
index a077f8f9..95496adb 100644
--- a/backend/src/applications/spaces/spaces.controller.ts
+++ b/backend/src/applications/spaces/spaces.controller.ts
@@ -149,7 +149,7 @@ export class SpacesController {
createUserRoots(
@GetUser() user: UserModel,
@Param('id', ParseIntPipe) spaceId: number,
- @Body(new ParseArrayPipe({ items: SpaceRootDto })) roots: SpaceRootDto[]
+ @Body(new ParseArrayPipe({ items: SpaceRootDto, whitelist: true })) roots: SpaceRootDto[]
): Promise<SpaceRootDto[]> {
return this.spacesManager.updateUserRoots(user, spaceId, roots, true)
}
@@ -158,7 +158,7 @@ export class SpacesController {
updateUserRoots(
@GetUser() user: UserModel,
@Param('id', ParseIntPipe) spaceId: number,
- @Body(new ParseArrayPipe({ items: SpaceRootDto })) roots: SpaceRootDto[]
+ @Body(new ParseArrayPipe({ items: SpaceRootDto, whitelist: true })) roots: SpaceRootDto[]
): Promise<SpaceRootDto[]> {
return this.spacesManager.updateUserRoots(user, spaceId, roots)
}
diff --git a/backend/src/applications/sync/sync.controller.ts b/backend/src/applications/sync/sync.controller.ts
index 082d2800..dc73e2fa 100644
--- a/backend/src/applications/sync/sync.controller.ts
+++ b/backend/src/applications/sync/sync.controller.ts
@@ -164,7 +164,7 @@ export class SyncController {
@UseInterceptors(ContextInterceptor)
updatePaths(
@GetUser() user: UserModel,
- @Body(new ParseArrayPipe({ items: SyncPathDto })) syncPathsDto: SyncPathDto[]
+ @Body(new ParseArrayPipe({ items: SyncPathDto, whitelist: true })) syncPathsDto: SyncPathDto[]
): Promise<{
add: SyncPathSettings[]
update: Partial<Record<keyof SyncPathSettings, any>>[]