/
goncharovchik
/
secure-api-d
Обзор
Документация
Войти
/
goncharovchik
/
secure-api-d
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
insecure
src/app.module.ts
58 строк
2 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 { Module } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; import { TypeOrmModule } from '@nestjs/typeorm'; import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions'; import appConfig from './config/app.config'; import databaseConfig from './config/database.config'; import { UsersModule } from './modules/users/users.module'; import { AuthModule } from './modules/auth/auth.module'; import { BotsModule } from './modules/bots/bots.module'; import { ServersModule } from './modules/servers/servers.module'; /** * Корневой модуль приложения. * INSECURE: * - Нет middleware (RequestId, JsonDepth, Fingerprint) * - Нет MemoryWatchdog * - Нет ScheduleModule * - Нет ограничений пула соединений БД (max не задан) * - Нет statement_timeout * - Нет SecurityModule, AuditModule */ @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true, load: [appConfig, databaseConfig], }), TypeOrmModule.forRootAsync({ imports: [ConfigModule], inject: [ConfigService], useFactory: (config: ConfigService) => { const options: PostgresConnectionOptions & { autoLoadEntities: boolean } = { type: 'postgres', host: config.get<string>('database.host'), port: config.get<number>('database.port'), username: config.get<string>('database.username'), password: config.get<string>('database.password'), database: config.get<string>('database.database')!, synchronize: true, // INSECURE: auto-sync в production // INSECURE: нет ограничений пула соединений // INSECURE: нет statement_timeout autoLoadEntities: true, }; return options; }, }), UsersModule, AuthModule, BotsModule, ServersModule, // INSECURE: нет SecurityModule // INSECURE: нет AuditModule ], }) export class AppModule {}