fix(security): add fileFilter mime check to pets upload and Throttling to tickets endpoints
Deploy Canina / deploy (push) Failing after 1m1s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s

This commit is contained in:
devops committed 2026-10-12 18:54:47 +00:00
1 parent 4d5159a169
commit e9582430e6
2 files changed
+15

No files matched your search

+12
View File
@@ -75,6 +75,18 @@ export class PetsController {
},
}),
limits: { fileSize: 10 * 1024 * 1024 }, // 10MB
fileFilter: (_req, file, callback) => {
const allowedMimeTypes = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'];
if (!allowedMimeTypes.includes(file.mimetype)) {
return callback(
new BadRequestException(
'فرمت فایل مجاز نیست. لطفاً یکی از فرمت‌های JPG, PNG, WEBP را انتخاب کنید',
),
false,
);
}
callback(null, true);
},
}),
)
@ApiOperation({ summary: 'آپلود تصویر حیوان خانگی' })
@@ -1,3 +1,4 @@
import { Throttle } from '@nestjs/throttler';
import {
Controller,
Get,
@@ -33,6 +34,7 @@ import {
export class TicketsController {
constructor(private readonly ticketsService: TicketsService) {}
@Throttle({ default: { limit: 5, ttl: 60000 } })
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@Post()
@@ -66,6 +68,7 @@ export class TicketsController {
return this.ticketsService.getTicketDetails(id, req.user.id, isAdmin);
}
@Throttle({ default: { limit: 10, ttl: 60000 } })
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@Post(':id/messages')