mirror of https://github.com/apache/cloudstack.git
Refine regex pattern for domain path matching
Updated regex pattern to escape only the '/' character while noting potential risks with the wildcard '.' character.
This commit is contained in:
parent
274c5f7482
commit
1a7c6345aa
|
|
@ -1074,7 +1074,7 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
|
|||
for (Map.Entry<Long, List<String>> entry : idsOfDomainsWithResourcesUsedByDomainToBeMoved.entrySet()) {
|
||||
DomainVO domainWithResourceUsedByDomainToBeMoved = _domainDao.findById(entry.getKey());
|
||||
|
||||
Pattern pattern = Pattern.compile(domainWithResourceUsedByDomainToBeMoved.getPath().replace("/", "\\/").concat(".*"));
|
||||
Pattern pattern = Pattern.compile(domainWithResourceUsedByDomainToBeMoved.getPath().replace("/", "\\/").concat(".*")); // This only scaped one Regex metacharacter (/). The wildcard `.` is more common and dangerous in my opinion.
|
||||
Matcher matcher = pattern.matcher(newPathOfDomainToBeMoved);
|
||||
if (!matcher.matches()) {
|
||||
domainsOfResourcesInaccessibleToNewParentDomain.put(domainWithResourceUsedByDomainToBeMoved, entry.getValue());
|
||||
|
|
|
|||
Loading…
Reference in New Issue