Tighten Docker hostname regex for monitor URL validation
This commit is contained in:
1 parent
b823f0f7db
commit
8ffd9a5e2a
2 files changed
+2
-2
No files matched your search
@@ -130,7 +130,7 @@ const monitorValidation = joi.object({
|
||||
.custom((value, helpers) => {
|
||||
const noProtocol = value.replace(/^(https?:\/\/)/, "");
|
||||
|
||||
if (/^[a-zA-Z0-9.-]+(:\d{1,5})?$/.test(noProtocol)) {
|
||||
if (/^[a-zA-Z0-9]([a-zA-Z0-9.-]*[a-zA-Z0-9])?(:\d{1,5})?$/.test(noProtocol)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ const createMonitorBodyValidation = joi.object({
|
||||
.custom((value, helpers) => {
|
||||
const noProtocol = value.replace(/^(https?:\/\/)/, "");
|
||||
|
||||
if (/^[a-zA-Z0-9.-]+(:\d{1,5})?$/.test(noProtocol)) {
|
||||
if (/^[a-zA-Z0-9]([a-zA-Z0-9.-]*[a-zA-Z0-9])?(:\d{1,5})?$/.test(noProtocol)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user