Commit fd9b05c2 authored by Oliver Bartsch's avatar Oliver Bartsch

[BUGFIX] Soften extension key pattern in TokenCreationValidator

parent 8c4bb65c
Pipeline #10076 passed with stages
in 6 minutes and 19 seconds
......@@ -76,11 +76,7 @@ class TokenCreationValidator extends AbstractValidator
if ($value->getExtensions() !== []) {
foreach ($value->getExtensions() as $extension) {
$length = strlen(trim($extension));
if ($length < 3
|| $length > 30
|| !(bool)preg_match('/^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z]{1}[a-z0-9_]+)$/', $extension)
) {
if (!(bool)preg_match('/^[a-z][a-z0-9_]{2,29}$/', $extension)) {
$this->addError($extension . ' is no valid extension key', 1605034751);
return false;
}
......
......@@ -111,7 +111,7 @@ class TokenCreatingValidatorTest extends AbstractTestCase
1605034751
];
yield 'Invalid extension name 2' => [
['password', '', null, [], ['valid_ext', 'tx_ext']],
['password', '', null, [], ['valid_ext', '_ext']],
1605034751
];
yield 'Invalid extension name 3' => [
......
......@@ -228,7 +228,7 @@
"items": {
"maxLength": 30,
"minLength": 3,
"pattern": "^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z]{1}[a-z0-9_]+)$",
"pattern": "^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z][a-z0-9_]+)$",
"type": "string"
}
},
......@@ -837,7 +837,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -965,7 +965,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1097,7 +1097,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1237,7 +1237,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1360,7 +1360,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1490,7 +1490,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1644,7 +1644,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1787,7 +1787,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -1965,7 +1965,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -2103,7 +2103,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -3070,7 +3070,7 @@
"schema": {
"maxLength": 30,
"minLength": 3,
"pattern": "^[a-z]{1}[a-z0-9_]+$",
"pattern": "^[a-z][a-z0-9_]+$",
"type": "string"
},
"example": "my_typo3_extension"
......@@ -3246,7 +3246,7 @@
"items": {
"maxLength": 30,
"minLength": 3,
"pattern": "^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z]{1}[a-z0-9_]+)$",
"pattern": "^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z][a-z0-9_]+)$",
"type": "string"
}
},
......
......@@ -162,7 +162,7 @@ paths:
items:
maxLength: 30
minLength: 3
pattern: ^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z]{1}[a-z0-9_]+)$
pattern: ^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z][a-z0-9_]+)$
type: string
example: my_new_extension,another_awesome_extension
responses:
......@@ -557,7 +557,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
responses:
......@@ -636,7 +636,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
requestBody:
......@@ -718,7 +718,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
responses:
......@@ -806,7 +806,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
responses:
......@@ -882,7 +882,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
responses:
......@@ -962,7 +962,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
- name: username
......@@ -1060,7 +1060,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
- name: version
......@@ -1151,7 +1151,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
- name: version
......@@ -1264,7 +1264,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
- name: version
......@@ -1352,7 +1352,7 @@ paths:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
- name: version
......@@ -2002,7 +2002,7 @@ components:
schema:
maxLength: 30
minLength: 3
pattern: ^[a-z]{1}[a-z0-9_]+$
pattern: ^[a-z][a-z0-9_]+$
type: string
example: my_typo3_extension
Username:
......@@ -2149,7 +2149,7 @@ components:
items:
maxLength: 30
minLength: 3
pattern: ^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z]{1}[a-z0-9_]+)$
pattern: ^((?!(tx|user|pages|tt|sys|ts_language|csh))[a-z][a-z0-9_]+)$
type: string
example: my_new_extension,another_awesome_extension
requestBodies:
......
......@@ -106,7 +106,7 @@ class RouteArgumentFactoryTest extends AbstractTestCase
$this->getStringArgumentConfiguration(['value' => '12345foobar']),
'{"name":"key","value":"12345foobar","validationErrors":["The given value \'12345foobar\' for argument \'key\''
. ' must be at max 10 chars long.","The given value \'12345foobar\' for argument \'key\' does not match the pattern:'
. ' ^[a-z]{1}[a-z0-9_]+$"]}',
. ' ^[a-z][a-z0-9_]+$"]}',
0
];
yield 'StringArgument Invalid (wrong type)' => [
......@@ -198,7 +198,7 @@ class RouteArgumentFactoryTest extends AbstractTestCase
'type' => 'string',
'minLength' => 1,
'maxLength' => 10,
'pattern' => '^[a-z]{1}[a-z0-9_]+$'
'pattern' => '^[a-z][a-z0-9_]+$'
]
]
],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment