/
goncharovchik
/
secure-api-d
Обзор
Документация
Войти
/
goncharovchik
/
secure-api-d
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
insecure
src/modules/auth/auth.controller.ts
36 строк
1 KB
Aleksey Goncharov
feat: insecure API — intentionally vulnerable (no auth, no validation, SQL injection, plain text passwords)
29 апр 2026, 12:02
29 апр 2026, 12:02
651dea3
Код
Авторство
О чём код?
import { Controller, Post, Body } from '@nestjs/common'; import { ApiTags, ApiOperation } from '@nestjs/swagger'; import { AuthService } from './auth.service'; import { LoginDto } from './dto/login.dto'; import { RegisterDto } from './dto/register.dto'; /** * Контроллер аутентификации. * INSECURE: нет JWT, нет rate limiting, нет brute force protection. */ @ApiTags('Auth') @Controller('api/auth') export class AuthController { constructor(private readonly authService: AuthService) {} /** INSECURE: пароль «1» принимается */ @Post('register') @ApiOperation({ summary: 'Регистрация нового пользователя' }) register(@Body() dto: RegisterDto) { return this.authService.register(dto); } /** INSECURE: бесконечные попытки входа */ @Post('login') @ApiOperation({ summary: 'Вход в систему' }) login(@Body() dto: LoginDto) { return this.authService.login(dto); } /** INSECURE: refresh token не проверяется */ @Post('refresh') @ApiOperation({ summary: 'Обновить токен' }) refresh(@Body('refreshToken') refreshToken: string) { return this.authService.refresh(refreshToken); } }