fix(security): resolve all critical, high, and medium security vulnerabilities
This commit is contained in:
1 parent
da26dd1c8d
commit
dc88677169
33 files changed
+438
-85
No files matched your search
@@ -92,6 +92,7 @@ export class AuthController {
|
||||
return this.authService.login(loginDto);
|
||||
}
|
||||
|
||||
@Throttle({ default: { limit: 5, ttl: 300000 } }) // 5 attempts per 5 minutes
|
||||
@Post('admin-login')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'ورود ادمین به پنل مدیریت' })
|
||||
@@ -116,11 +117,18 @@ export class AuthController {
|
||||
return this.authService.refresh(req.user);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Post('logout')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'خروج از حساب کاربری' })
|
||||
@ApiOperation({ summary: 'خروج از حساب کاربری و ابطال توکن' })
|
||||
@ApiOkResponse({ description: 'با موفقیت خارج شدید' })
|
||||
logout() {
|
||||
async logout(@Req() req: any) {
|
||||
const authHeader = req.headers?.authorization;
|
||||
if (authHeader && authHeader.startsWith('Bearer ')) {
|
||||
const token = authHeader.replace('Bearer ', '').trim();
|
||||
await this.authService.blacklistToken(token);
|
||||
}
|
||||
return { success: true, message: 'با موفقیت خارج شدید' };
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user