chore: upgrade dependencies

This commit is contained in:
Elias Schneider
2024-07-01 11:08:23 +02:00
parent 31366d961f
commit 9193a79b9a
11 changed files with 1253 additions and 813 deletions

1893
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,20 +14,20 @@
}, },
"dependencies": { "dependencies": {
"@nestjs/cache-manager": "^2.2.2", "@nestjs/cache-manager": "^2.2.2",
"@nestjs/common": "^10.3.8", "@nestjs/common": "^10.3.9",
"@nestjs/config": "^3.2.2", "@nestjs/config": "^3.2.2",
"@nestjs/core": "^10.3.8", "@nestjs/core": "^10.3.9",
"@nestjs/jwt": "^10.2.0", "@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3", "@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.8", "@nestjs/platform-express": "^10.3.9",
"@nestjs/schedule": "^3.0.4", "@nestjs/schedule": "^4.0.2",
"@nestjs/swagger": "^7.3.1", "@nestjs/swagger": "^7.3.1",
"@nestjs/throttler": "^4.2.1", "@nestjs/throttler": "^5.2.0",
"@prisma/client": "^5.14.0", "@prisma/client": "^5.16.1",
"archiver": "^5.3.2", "archiver": "^7.0.1",
"argon2": "^0.40.1", "argon2": "^0.40.3",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"cache-manager": "^5.5.2", "cache-manager": "^5.6.1",
"clamscan": "^2.2.1", "clamscan": "^2.2.1",
"class-transformer": "^0.5.1", "class-transformer": "^0.5.1",
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
@@ -36,50 +36,48 @@
"mime-types": "^2.1.35", "mime-types": "^2.1.35",
"moment": "^2.30.1", "moment": "^2.30.1",
"nanoid": "^3.3.7", "nanoid": "^3.3.7",
"node-fetch": "^2.7.0", "nodemailer": "^6.9.14",
"nodemailer": "^6.9.13",
"otplib": "^12.0.1", "otplib": "^12.0.1",
"passport": "^0.7.0", "passport": "^0.7.0",
"passport-jwt": "^4.0.1", "passport-jwt": "^4.0.1",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"qrcode-svg": "^1.1.0", "qrcode-svg": "^1.1.0",
"reflect-metadata": "^0.1.12", "reflect-metadata": "^0.2.2",
"rimraf": "^5.0.7", "rimraf": "^5.0.7",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"sharp": "^0.32.4", "sharp": "^0.33.4",
"ts-node": "^10.9.2" "ts-node": "^10.9.2"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^10.3.2", "@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1", "@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.8", "@nestjs/testing": "^10.3.9",
"@types/archiver": "^5.3.4", "@types/archiver": "^6.0.2",
"@types/clamscan": "^2.0.8", "@types/clamscan": "^2.0.8",
"@types/cookie-parser": "^1.4.7", "@types/cookie-parser": "^1.4.7",
"@types/cron": "^2.0.1", "@types/cron": "^2.0.1",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/mime-types": "^2.1.4", "@types/mime-types": "^2.1.4",
"@types/multer": "^1.4.11", "@types/multer": "^1.4.11",
"@types/node": "^20.12.12", "@types/node": "^20.14.9",
"@types/node-fetch": "^2.6.11",
"@types/nodemailer": "^6.4.15", "@types/nodemailer": "^6.4.15",
"@types/passport-jwt": "^3.0.13", "@types/passport-jwt": "^4.0.1",
"@types/qrcode-svg": "^1.1.4", "@types/qrcode-svg": "^1.1.4",
"@types/sharp": "^0.31.1", "@types/sharp": "^0.31.1",
"@types/supertest": "^2.0.16", "@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^6.21.0", "@typescript-eslint/parser": "^7.14.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.57.0", "eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"newman": "^6.1.2", "newman": "^6.1.3",
"prettier": "^3.2.5", "prettier": "^3.3.2",
"prisma": "^5.14.0", "prisma": "^5.16.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-loader": "^9.5.1", "ts-loader": "^9.5.1",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"typescript": "^5.4.5", "typescript": "^5.5.2",
"wait-on": "^7.2.0" "wait-on": "^7.2.0"
} }
} }

View File

@@ -3,20 +3,20 @@ import { Module } from "@nestjs/common";
import { ScheduleModule } from "@nestjs/schedule"; import { ScheduleModule } from "@nestjs/schedule";
import { AuthModule } from "./auth/auth.module"; import { AuthModule } from "./auth/auth.module";
import { CacheModule } from "@nestjs/cache-manager";
import { APP_GUARD } from "@nestjs/core"; import { APP_GUARD } from "@nestjs/core";
import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler"; import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler";
import { AppController } from "./app.controller";
import { ClamScanModule } from "./clamscan/clamscan.module";
import { ConfigModule } from "./config/config.module"; import { ConfigModule } from "./config/config.module";
import { EmailModule } from "./email/email.module"; import { EmailModule } from "./email/email.module";
import { FileModule } from "./file/file.module"; import { FileModule } from "./file/file.module";
import { JobsModule } from "./jobs/jobs.module"; import { JobsModule } from "./jobs/jobs.module";
import { OAuthModule } from "./oauth/oauth.module";
import { PrismaModule } from "./prisma/prisma.module"; import { PrismaModule } from "./prisma/prisma.module";
import { ReverseShareModule } from "./reverseShare/reverseShare.module";
import { ShareModule } from "./share/share.module"; import { ShareModule } from "./share/share.module";
import { UserModule } from "./user/user.module"; import { UserModule } from "./user/user.module";
import { ClamScanModule } from "./clamscan/clamscan.module";
import { ReverseShareModule } from "./reverseShare/reverseShare.module";
import { AppController } from "./app.controller";
import { OAuthModule } from "./oauth/oauth.module";
import { CacheModule } from "@nestjs/cache-manager";
@Module({ @Module({
imports: [ imports: [
@@ -28,10 +28,12 @@ import { CacheModule } from "@nestjs/cache-manager";
ConfigModule, ConfigModule,
JobsModule, JobsModule,
UserModule, UserModule,
ThrottlerModule.forRoot({ ThrottlerModule.forRoot([
{
ttl: 60, ttl: 60,
limit: 100, limit: 100,
}), },
]),
ScheduleModule.forRoot(), ScheduleModule.forRoot(),
ClamScanModule, ClamScanModule,
ReverseShareModule, ReverseShareModule,

View File

@@ -37,7 +37,12 @@ export class AuthController {
) {} ) {}
@Post("signUp") @Post("signUp")
@Throttle(10, 5 * 60) @Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
async signUp( async signUp(
@Body() dto: AuthRegisterDTO, @Body() dto: AuthRegisterDTO,
@Res({ passthrough: true }) response: Response, @Res({ passthrough: true }) response: Response,
@@ -57,7 +62,12 @@ export class AuthController {
} }
@Post("signIn") @Post("signIn")
@Throttle(10, 5 * 60) @Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(200) @HttpCode(200)
async signIn( async signIn(
@Body() dto: AuthSignInDTO, @Body() dto: AuthSignInDTO,
@@ -77,7 +87,12 @@ export class AuthController {
} }
@Post("signIn/totp") @Post("signIn/totp")
@Throttle(10, 5 * 60) @Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(200) @HttpCode(200)
async signInTotp( async signInTotp(
@Body() dto: AuthSignInTotpDTO, @Body() dto: AuthSignInTotpDTO,
@@ -95,14 +110,24 @@ export class AuthController {
} }
@Post("resetPassword/:email") @Post("resetPassword/:email")
@Throttle(5, 5 * 60) @Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(202) @HttpCode(202)
async requestResetPassword(@Param("email") email: string) { async requestResetPassword(@Param("email") email: string) {
this.authService.requestResetPassword(email); this.authService.requestResetPassword(email);
} }
@Post("resetPassword") @Post("resetPassword")
@Throttle(5, 5 * 60) @Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(204) @HttpCode(204)
async resetPassword(@Body() dto: ResetPasswordDTO) { async resetPassword(@Body() dto: ResetPasswordDTO) {
return await this.authService.resetPassword(dto.token, dto.password); return await this.authService.resetPassword(dto.token, dto.password);

View File

@@ -1,5 +1,4 @@
import { Injectable } from "@nestjs/common"; import { Injectable } from "@nestjs/common";
import fetch from "node-fetch";
import { ConfigService } from "../../config/config.service"; import { ConfigService } from "../../config/config.service";
import { OAuthCallbackDto } from "../dto/oauthCallback.dto"; import { OAuthCallbackDto } from "../dto/oauthCallback.dto";
import { OAuthSignInDto } from "../dto/oauthSignIn.dto"; import { OAuthSignInDto } from "../dto/oauthSignIn.dto";
@@ -52,7 +51,7 @@ export class DiscordProvider implements OAuthProvider<DiscordToken> {
this.config.get("general.appUrl") + "/api/oauth/callback/discord", this.config.get("general.appUrl") + "/api/oauth/callback/discord",
}), }),
}); });
const token: DiscordToken = await res.json(); const token = (await res.json()) as DiscordToken;
return { return {
accessToken: token.access_token, accessToken: token.access_token,
refreshToken: token.refresh_token, refreshToken: token.refresh_token,

View File

@@ -1,5 +1,4 @@
import { Logger } from "@nestjs/common"; import { Logger } from "@nestjs/common";
import fetch from "node-fetch";
import { ConfigService } from "../../config/config.service"; import { ConfigService } from "../../config/config.service";
import { JwtService } from "@nestjs/jwt"; import { JwtService } from "@nestjs/jwt";
import { Cache } from "cache-manager"; import { Cache } from "cache-manager";
@@ -25,7 +24,7 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
protected cache: Cache, protected cache: Cache,
) { ) {
this.discoveryUri = this.getDiscoveryUri(); this.discoveryUri = this.getDiscoveryUri();
this.config.addListener("update", (key: string, _: unknown) => { this.config.addListener("update", (key: string) => {
if (this.keyOfConfigUpdateEvents.includes(key)) { if (this.keyOfConfigUpdateEvents.includes(key)) {
this.deinit(); this.deinit();
this.discoveryUri = this.getDiscoveryUri(); this.discoveryUri = this.getDiscoveryUri();
@@ -94,7 +93,7 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
redirect_uri: this.getRedirectUri(), redirect_uri: this.getRedirectUri(),
}).toString(), }).toString(),
}); });
const token: OidcToken = await res.json(); const token = (await res.json()) as OidcToken;
return { return {
accessToken: token.access_token, accessToken: token.access_token,
expiresIn: token.expires_in, expiresIn: token.expires_in,
@@ -159,7 +158,7 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
: Date.now() + 1000 * 60 * 60 * 24; : Date.now() + 1000 * 60 * 60 * 24;
this.configuration = { this.configuration = {
expires, expires,
data: await res.json(), data: (await res.json()) as OidcConfiguration,
}; };
} }

View File

@@ -1,5 +1,4 @@
import { Injectable } from "@nestjs/common"; import { Injectable } from "@nestjs/common";
import fetch from "node-fetch";
import { ConfigService } from "../../config/config.service"; import { ConfigService } from "../../config/config.service";
import { OAuthCallbackDto } from "../dto/oauthCallback.dto"; import { OAuthCallbackDto } from "../dto/oauthCallback.dto";
import { OAuthSignInDto } from "../dto/oauthSignIn.dto"; import { OAuthSignInDto } from "../dto/oauthSignIn.dto";
@@ -38,7 +37,7 @@ export class GitHubProvider implements OAuthProvider<GitHubToken> {
}, },
}, },
); );
const token: GitHubToken = await res.json(); const token = (await res.json()) as GitHubToken;
return { return {
accessToken: token.access_token, accessToken: token.access_token,
tokenType: token.token_type, tokenType: token.token_type,

View File

@@ -36,7 +36,12 @@ export class ReverseShareController {
return { token, link }; return { token, link };
} }
@Throttle(20, 60) @Throttle({
default: {
limit: 20,
ttl: 60,
},
})
@Get(":reverseShareToken") @Get(":reverseShareToken")
async getByToken(@Param("reverseShareToken") reverseShareToken: string) { async getByToken(@Param("reverseShareToken") reverseShareToken: string) {
const isValid = await this.reverseShareService.isValid(reverseShareToken); const isValid = await this.reverseShareService.isValid(reverseShareToken);

View File

@@ -16,6 +16,7 @@ import { Request, Response } from "express";
import { GetUser } from "src/auth/decorator/getUser.decorator"; import { GetUser } from "src/auth/decorator/getUser.decorator";
import { AdministratorGuard } from "src/auth/guard/isAdmin.guard"; import { AdministratorGuard } from "src/auth/guard/isAdmin.guard";
import { JwtGuard } from "src/auth/guard/jwt.guard"; import { JwtGuard } from "src/auth/guard/jwt.guard";
import { AdminShareDTO } from "./dto/adminShare.dto";
import { CreateShareDTO } from "./dto/createShare.dto"; import { CreateShareDTO } from "./dto/createShare.dto";
import { MyShareDTO } from "./dto/myShare.dto"; import { MyShareDTO } from "./dto/myShare.dto";
import { ShareDTO } from "./dto/share.dto"; import { ShareDTO } from "./dto/share.dto";
@@ -26,7 +27,6 @@ import { ShareOwnerGuard } from "./guard/shareOwner.guard";
import { ShareSecurityGuard } from "./guard/shareSecurity.guard"; import { ShareSecurityGuard } from "./guard/shareSecurity.guard";
import { ShareTokenSecurity } from "./guard/shareTokenSecurity.guard"; import { ShareTokenSecurity } from "./guard/shareTokenSecurity.guard";
import { ShareService } from "./share.service"; import { ShareService } from "./share.service";
import { AdminShareDTO } from "./dto/adminShare.dto";
@Controller("shares") @Controller("shares")
export class ShareController { export class ShareController {
constructor(private shareService: ShareService) {} constructor(private shareService: ShareService) {}
@@ -99,14 +99,24 @@ export class ShareController {
await this.shareService.remove(id, isDeleterAdmin); await this.shareService.remove(id, isDeleterAdmin);
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Get("isShareIdAvailable/:id") @Get("isShareIdAvailable/:id")
async isShareIdAvailable(@Param("id") id: string) { async isShareIdAvailable(@Param("id") id: string) {
return this.shareService.isShareIdAvailable(id); return this.shareService.isShareIdAvailable(id);
} }
@HttpCode(200) @HttpCode(200)
@Throttle(20, 5 * 60) @Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@UseGuards(ShareTokenSecurity) @UseGuards(ShareTokenSecurity)
@Post(":id/token") @Post(":id/token")
async getShareToken( async getShareToken(

View File

@@ -11,7 +11,7 @@ import { ShareService } from "./share.service";
imports: [ imports: [
JwtModule.register({}), JwtModule.register({}),
EmailModule, EmailModule,
ClamScanModule, forwardRef(() => ClamScanModule),
ReverseShareModule, ReverseShareModule,
forwardRef(() => FileModule), forwardRef(() => FileModule),
], ],

View File

@@ -4022,11 +4022,11 @@
} }
}, },
"node_modules/braces": { "node_modules/braces": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dependencies": { "dependencies": {
"fill-range": "^7.0.1" "fill-range": "^7.1.1"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@@ -5673,9 +5673,9 @@
} }
}, },
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.0.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dependencies": { "dependencies": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
}, },
@@ -12547,11 +12547,11 @@
} }
}, },
"braces": { "braces": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"requires": { "requires": {
"fill-range": "^7.0.1" "fill-range": "^7.1.1"
} }
}, },
"browserslist": { "browserslist": {
@@ -13772,9 +13772,9 @@
} }
}, },
"fill-range": { "fill-range": {
"version": "7.0.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"requires": { "requires": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
} }