daviftorres commented on code in PR #12937:
URL: https://github.com/apache/cloudstack/pull/12937#discussion_r3025026480
##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -1074,7 +1074,7 @@ protected void
validateNewParentDomainCanAccessResourcesOfDomainToBeMoved(String
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.
Review Comment:
Hey @DaanHoogland, do not forget this other part of the code that only
escapes `/`, then adds the God of wildcards (`.*`), and passes for a domain to
be moved.
I guess this has the potential of corrupting all resources of the domain
being moved or affecting some other unrelated domain that happens to match the
Regex.
But I am not qualified to propose a code fix in this case. I would like your
help to assess this bug, too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]