Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
services
T
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
fd9b05c2
Commit
fd9b05c2
authored
Nov 27, 2020
by
Oliver Bartsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUGFIX] Soften extension key pattern in TokenCreationValidator
parent
8c4bb65c
Pipeline
#10076
passed with stages
in 6 minutes and 19 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
34 deletions
+30
-34
extensions/ter_fe2/Classes/Validation/Validator/TokenCreationValidator.php
...2/Classes/Validation/Validator/TokenCreationValidator.php
+1
-5
extensions/ter_fe2/Tests/Unit/Validation/TokenCreatingValidatorTest.php
..._fe2/Tests/Unit/Validation/TokenCreatingValidatorTest.php
+1
-1
extensions/ter_rest/Resources/Private/Schema/v1.json
extensions/ter_rest/Resources/Private/Schema/v1.json
+13
-13
extensions/ter_rest/Resources/Private/Schema/v1.yaml
extensions/ter_rest/Resources/Private/Schema/v1.yaml
+13
-13
extensions/ter_rest/Tests/Unit/Routing/RouteArgument/RouteArgumentFactoryTest.php
...s/Unit/Routing/RouteArgument/RouteArgumentFactoryTest.php
+2
-2
No files found.
extensions/ter_fe2/Classes/Validation/Validator/TokenCreationValidator.php
View file @
fd9b05c2
...
...
@@ -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
;
}
...
...
extensions/ter_fe2/Tests/Unit/Validation/TokenCreatingValidatorTest.php
View file @
fd9b05c2
...
...
@@ -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'
=>
[
...
...
extensions/ter_rest/Resources/Private/Schema/v1.json
View file @
fd9b05c2
...
...
@@ -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"
}
},
...
...
extensions/ter_rest/Resources/Private/Schema/v1.yaml
View file @
fd9b05c2
...
...
@@ -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
:
...
...
extensions/ter_rest/Tests/Unit/Routing/RouteArgument/RouteArgumentFactoryTest.php
View file @
fd9b05c2
...
...
@@ -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_]+$'
]
]
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment