@hapi/validate
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -44,4 +44,4 @@ 'use strict'; | ||
domainControlRx: /[\x00-\x20@\:\/]/, // Control + space + separators | ||
tldSegmentRx: /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/, | ||
domainSegmentRx: /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/ | ||
domainSegmentRx: /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/, | ||
finalSegmentAdditionalRx: /[^0-9]/ // Domain segment which is additionally not all-numeric | ||
}; | ||
@@ -705,11 +705,15 @@ | ||
if (i < segments.length - 1) { | ||
if (!internals.domainSegmentRx.test(segment)) { | ||
return false; | ||
} | ||
// Here we're following RFC 1035 and 1123, plus 3696's clarification | ||
// that the final segment may contain numbers but not be all-numeric. | ||
// Docker containers, for example, are assigned hostnames which are hex | ||
// strings (no dots) that may start with a numeric digit. | ||
if (!internals.domainSegmentRx.test(segment)) { | ||
return false; | ||
} | ||
else { | ||
if (!internals.tldSegmentRx.test(segment)) { | ||
return false; | ||
} | ||
const isFinalSegment = i === segments.length - 1; | ||
if (isFinalSegment && !internals.finalSegmentAdditionalRx.test(segment)) { | ||
return false; | ||
} | ||
@@ -716,0 +720,0 @@ } |
{ | ||
"name": "@hapi/validate", | ||
"description": "Object schema validation", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"repository": "git://github.com/hapijs/validate", | ||
@@ -17,3 +17,3 @@ "main": "lib/index.js", | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "23.x.x" | ||
"@hapi/lab": "24.x.x" | ||
}, | ||
@@ -20,0 +20,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
213220
5522