File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 88 uniqBy ,
99} from 'lodash' ;
1010import { ConflictException , Injectable } from '@nestjs/common' ;
11+ import { isUUID } from 'class-validator' ;
1112import { ENV_CONFIG } from 'src/config' ;
1213import { Logger } from 'src/shared/global' ;
1314import {
@@ -61,6 +62,10 @@ export class ChallengesService {
6162 ) { }
6263
6364 async getChallenge ( challengeId : string ) {
65+ if ( ! isUUID ( challengeId ) ) {
66+ throw new BadRequestException ( 'Invalid challengeId provided! Uuid expected!' ) ;
67+ }
68+
6469 // Use the URL constructor to avoid path traversal/SSRF risks.
6570 const baseUrl = TC_API_BASE . endsWith ( '/' ) ? TC_API_BASE . slice ( 0 , - 1 ) : TC_API_BASE ;
6671 const requestUrl = new URL ( `/challenges/${ challengeId } ` , baseUrl ) . toString ( ) ;
You can’t perform that action at this time.
0 commit comments