Skip to content

Commit 274c5f7

Browse files
authored
Domain is passed as a REGEX pattern, not a literal string.
This change ensures consistency with how paths are parsed when updating a domain path. The modified line was passing the domain name as a literal string, but it is actually interpreted as a regular expression internally. I couldn’t find a way to exploit this issue, but it could still cause data corruption if a domain name accidentally contains regex metacharacters. Note that this same technique is already used in a similar situation on line 1118. A common example is when an organization uses its DNS name as the "domain" (tenant), like `company.com`. In this case, the `.` (dot) is treated as a regex wildcard, meaning it can match any character...
1 parent b6b5bfd commit 274c5f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/com/cloud/user/DomainManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ private void updateDomainChildren(DomainVO domain, String updatedDomainPrefix) {
938938
List<DomainVO> domainChildren = _domainDao.findAllChildren(domain.getPath(), domain.getId());
939939
// for each child, update the path
940940
for (DomainVO dom : domainChildren) {
941-
dom.setPath(dom.getPath().replaceFirst(domain.getPath(), updatedDomainPrefix));
941+
dom.setPath(StringUtils.replaceOnce(dom.getPath(), domain.getPath(), updatedDomainPrefix));
942942
_domainDao.update(dom.getId(), dom);
943943
}
944944
}

0 commit comments

Comments
 (0)