@@ -10,11 +10,6 @@ interface EvaluatorReturnType {
1010 result : 'Pass' | 'Fail' | 'Error'
1111}
1212
13- // Limit maximum array sizes to prevent DoS attacks
14- const MAX_OUTPUTS = 10000
15- const MAX_EVALUATORS = 1000
16- const MAX_SPLIT_VALUES = 1000
17-
1813export const runAdditionalEvaluators = async (
1914 metricsArray : ICommonObject [ ] ,
2015 actualOutputArray : string [ ] ,
@@ -27,14 +22,6 @@ export const runAdditionalEvaluators = async (
2722 throw new Error ( 'Invalid input: expected arrays' )
2823 }
2924
30- if ( actualOutputArray . length > MAX_OUTPUTS ) {
31- throw new Error ( `Too many outputs: maximum allowed is ${ MAX_OUTPUTS } ` )
32- }
33-
34- if ( selectedEvaluators . length > MAX_EVALUATORS ) {
35- throw new Error ( `Too many evaluators: maximum allowed is ${ MAX_EVALUATORS } ` )
36- }
37-
3825 const evaluationResults : any [ ] = [ ]
3926 const evaluatorDict : any = { }
4027
@@ -121,10 +108,6 @@ export const runAdditionalEvaluators = async (
121108 case 'ContainsAny' :
122109 passed = false
123110 splitValues = value . split ( ',' ) . map ( ( v ) => v . trim ( ) . toLowerCase ( ) ) // Split, trim, and convert to lowercase
124- // Limit split values to prevent unbounded iteration
125- if ( splitValues . length > MAX_SPLIT_VALUES ) {
126- throw new Error ( `Too many split values: maximum allowed is ${ MAX_SPLIT_VALUES } ` )
127- }
128111
129112 for ( let i = 0 ; i < splitValues . length ; i ++ ) {
130113 if ( actualOutput . includes ( splitValues [ i ] ) ) {
@@ -140,10 +123,6 @@ export const runAdditionalEvaluators = async (
140123 case 'ContainsAll' :
141124 passed = true
142125 splitValues = value . split ( ',' ) . map ( ( v ) => v . trim ( ) . toLowerCase ( ) ) // Split, trim, and convert to lowercase
143- // Limit split values to prevent unbounded iteration
144- if ( splitValues . length > MAX_SPLIT_VALUES ) {
145- throw new Error ( `Too many split values: maximum allowed is ${ MAX_SPLIT_VALUES } ` )
146- }
147126
148127 for ( let i = 0 ; i < splitValues . length ; i ++ ) {
149128 if ( ! actualOutput . includes ( splitValues [ i ] ) ) {
@@ -159,10 +138,6 @@ export const runAdditionalEvaluators = async (
159138 case 'DoesNotContainAny' :
160139 passed = true
161140 splitValues = value . split ( ',' ) . map ( ( v ) => v . trim ( ) . toLowerCase ( ) ) // Split, trim, and convert to lowercase
162- // Limit split values to prevent unbounded iteration
163- if ( splitValues . length > MAX_SPLIT_VALUES ) {
164- throw new Error ( `Too many split values: maximum allowed is ${ MAX_SPLIT_VALUES } ` )
165- }
166141
167142 for ( let i = 0 ; i < splitValues . length ; i ++ ) {
168143 if ( actualOutput . includes ( splitValues [ i ] ) ) {
@@ -178,10 +153,6 @@ export const runAdditionalEvaluators = async (
178153 case 'DoesNotContainAll' :
179154 passed = true
180155 splitValues = value . split ( ',' ) . map ( ( v ) => v . trim ( ) . toLowerCase ( ) ) // Split, trim, and convert to lowercase
181- // Limit split values to prevent unbounded iteration
182- if ( splitValues . length > MAX_SPLIT_VALUES ) {
183- throw new Error ( `Too many split values: maximum allowed is ${ MAX_SPLIT_VALUES } ` )
184- }
185156
186157 for ( let i = 0 ; i < splitValues . length ; i ++ ) {
187158 if ( actualOutput . includes ( splitValues [ i ] ) ) {
0 commit comments