File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ module.exports = {
49
49
type : 'string' ,
50
50
minLength : 1 ,
51
51
maxLength : 2048 ,
52
- pattern : "^[a-zA-Z0-9_!#$%&'*+.;/:, =^`|~- ]+$"
52
+ pattern : '^[\u0020-\u007e\u00a0-\u00ff ]+$'
53
53
}
54
54
} ,
55
55
additionalProperties : false
Original file line number Diff line number Diff line change @@ -181,6 +181,28 @@ exports.test_valid_static_headers_object = () => {
181
181
} ) ;
182
182
183
183
assert . equal ( isValid , true ) ;
184
+
185
+ for ( let i = 0x20 ; i <= 0xff ; i ++ ) {
186
+ if ( i > 0x7e && i < 0xa0 ) {
187
+ continue ;
188
+ }
189
+
190
+ const result = ajv . validate ( deploymentConfigSchema , {
191
+ 'static' : {
192
+ headers : [
193
+ {
194
+ source : '/' ,
195
+ headers : [ {
196
+ key : 'X-Test' ,
197
+ value : `value ${ String . fromCharCode ( i ) } `
198
+ } ]
199
+ }
200
+ ]
201
+ }
202
+ } ) ;
203
+
204
+ assert . equal ( result , true , `Failed to validate for char: 0x${ i . toString ( 16 ) } ` ) ;
205
+ }
184
206
} ;
185
207
186
208
exports . test_invalid_static_headers_object = ( ) => {
@@ -206,6 +228,27 @@ exports.test_invalid_static_headers_object = () => {
206
228
} ) ;
207
229
208
230
assert . equal ( isValid , false ) ;
231
+
232
+ // Use 256 to go above 0xff
233
+ for ( let i = 0 ; i <= 256 ; i ++ ) {
234
+ if ( ( i >= 0x20 && i <= 0x7e ) || ( i >= 0xa0 && i <= 0xff ) ) {
235
+ continue ;
236
+ }
237
+
238
+ const result = ajv . validate ( deploymentConfigSchema , {
239
+ 'static' : {
240
+ headers : {
241
+ source : '/' ,
242
+ headers : [ {
243
+ key : 'X-Test' ,
244
+ value : `value ${ String . fromCharCode ( i ) } `
245
+ } ]
246
+ }
247
+ }
248
+ } ) ;
249
+
250
+ assert . equal ( result , false , `Failed to error for char: 0x${ i . toString ( 16 ) } ` ) ;
251
+ }
209
252
} ;
210
253
211
254
exports . test_valid_static_object_trailing_slash = ( ) => {
You can’t perform that action at this time.
0 commit comments