fix(client): 🐛 do not allow private resumes to be viewable or downloadable through the link

This commit is contained in:
Amruth Pillai
2023-07-12 15:59:22 +02:00
parent 5ef4bfcb6b
commit 1c2d796c50
121 changed files with 3193 additions and 2068 deletions

View File

@ -7,69 +7,69 @@
"start": "node dist/main"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.348.0",
"@nestjs/axios": "^2.0.0",
"@nestjs/cache-manager": "^1.0.0",
"@nestjs/common": "^9.4.2",
"@nestjs/config": "^2.3.2",
"@nestjs/core": "^9.4.2",
"@nestjs/jwt": "^10.0.3",
"@nestjs/mapped-types": "^1.2.2",
"@nestjs/passport": "^9.0.3",
"@nestjs/platform-express": "^9.4.2",
"@nestjs/schedule": "^2.2.2",
"@nestjs/serve-static": "^3.0.1",
"@nestjs/terminus": "^9.2.2",
"@nestjs/typeorm": "^9.0.1",
"@aws-sdk/client-s3": "^3.369.0",
"@nestjs/axios": "^3.0.0",
"@nestjs/cache-manager": "^2.0.1",
"@nestjs/common": "^10.0.5",
"@nestjs/config": "^3.0.0",
"@nestjs/core": "^10.0.5",
"@nestjs/jwt": "^10.1.0",
"@nestjs/mapped-types": "^2.0.2",
"@nestjs/passport": "^10.0.0",
"@nestjs/platform-express": "^10.0.5",
"@nestjs/schedule": "^3.0.1",
"@nestjs/serve-static": "^4.0.0",
"@nestjs/terminus": "^10.0.1",
"@nestjs/typeorm": "^10.0.0",
"@types/passport": "^1.0.12",
"axios": "^1.4.0",
"bcryptjs": "^2.4.3",
"cache-manager": "^5.2.2",
"cache-manager": "^5.2.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"cookie-parser": "^1.4.6",
"csvtojson": "^2.0.10",
"dayjs": "^1.11.8",
"google-auth-library": "^8.8.0",
"dayjs": "^1.11.9",
"google-auth-library": "^8.9.0",
"joi": "^17.9.2",
"lodash": "^4.17.21",
"multer": "^1.4.5-lts.1",
"nanoid": "3.3.4",
"nanoid": "^3.3.6",
"node-stream-zip": "^1.15.0",
"nodemailer": "^6.9.3",
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pdf-lib": "^1.17.1",
"pg": "^8.11.0",
"playwright-chromium": "^1.34.3",
"pg": "^8.11.1",
"playwright-chromium": "^1.36.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"typeorm": "0.3.16",
"typeorm": "0.3.17",
"uuid": "^9.0.0"
},
"devDependencies": {
"@nestjs/cli": "^9.5.0",
"@nestjs/schematics": "^9.2.0",
"@nestjs/cli": "^10.1.8",
"@nestjs/schematics": "^10.0.1",
"@types/bcryptjs": "^2.4.2",
"@types/cookie-parser": "^1.4.3",
"@types/express": "^4.17.17",
"@types/lodash": "^4.14.195",
"@types/multer": "^1.4.7",
"@types/node": "^20.2.5",
"@types/node": "^20.4.1",
"@types/nodemailer": "^6.4.8",
"@types/passport-jwt": "^3.0.8",
"@types/passport-jwt": "^3.0.9",
"@types/passport-local": "^1.0.35",
"@types/uuid": "^9.0.1",
"eslint-plugin-unused-imports": "^2.0.0",
"prettier": "^2.8.8",
"@types/uuid": "^9.0.2",
"eslint-plugin-unused-imports": "^3.0.0",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"schema": "workspace:*",
"source-map-support": "^0.5.21",
"ts-loader": "^9.4.3",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3",
"webpack": "^5.86.0"
"typescript": "^5.1.6",
"webpack": "^5.88.1"
}
}

View File

@ -32,7 +32,7 @@ export class ResumeService {
constructor(
@InjectRepository(Resume) private resumeRepository: Repository<Resume>,
private configService: ConfigService,
private usersService: UsersService
private usersService: UsersService,
) {
this.s3Enabled = !isEmpty(configService.get('storage.bucket'));
@ -72,13 +72,13 @@ export class ResumeService {
if (error?.code === PostgresErrorCode.UniqueViolation) {
throw new HttpException(
'A resume with the same slug already exists, please enter a unique slug and try again.',
HttpStatus.BAD_REQUEST
HttpStatus.BAD_REQUEST,
);
}
throw new HttpException(
'Something went wrong. Please try again later, or raise an issue on GitHub if the problem persists.',
HttpStatus.INTERNAL_SERVER_ERROR
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ -102,7 +102,7 @@ export class ResumeService {
} catch {
throw new HttpException(
'Something went wrong. Please try again later, or raise an issue on GitHub if the problem persists.',
HttpStatus.INTERNAL_SERVER_ERROR
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ -212,13 +212,13 @@ export class ResumeService {
if (error?.code === PostgresErrorCode.UniqueViolation) {
throw new HttpException(
'A resume with the same slug already exists, please enter a unique slug and try again.',
HttpStatus.BAD_REQUEST
HttpStatus.BAD_REQUEST,
);
}
throw new HttpException(
'Something went wrong. Please try again later, or raise an issue on GitHub if the problem persists.',
HttpStatus.INTERNAL_SERVER_ERROR
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ -256,7 +256,7 @@ export class ResumeService {
Body: file.buffer,
ACL: 'public-read',
Bucket: this.configService.get('storage.bucket'),
})
}),
);
updatedResume = set(resume, 'basics.photo.url', publicUrl);
} else {
@ -271,7 +271,7 @@ export class ResumeService {
} catch (error) {
throw new HttpException(
'Something went wrong. Please try again later, or raise an issue on GitHub if the problem persists.',
HttpStatus.INTERNAL_SERVER_ERROR
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ -292,7 +292,7 @@ export class ResumeService {
new DeleteObjectCommand({
Key: key,
Bucket: this.configService.get('storage.bucket'),
})
}),
);
} else {
const serverUrl = this.configService.get('app.serverUrl');