Skip to content

Commit

Permalink
Secure docroot input field.
Browse files Browse the repository at this point in the history
  • Loading branch information
dterweij committed Mar 22, 2014
1 parent c1263a2 commit c09edab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kloxo/httpdocs/lib/domain/domainlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ function postAdd()
if(preg_match("/\.\.\//", $web-docroot)){
throw new lxexception("folder_name_may_not_contain_doubledotsslash","");
}
if(preg_match("/.*({|}|%|\"|$|'|`).*/", $web-docroot)){
throw new lxexception("folder_name_may_not_contain_bad_characters","");
}

$this->docroot = coreFfile::getRealpath($this->docroot);

Expand Down Expand Up @@ -648,6 +651,9 @@ function postAdd()
if(preg_match("/\.\.\//", $web-docroot)){
throw new lxexception("folder_name_may_not_contain_doubledotsslash","");
}
if(preg_match("/.*({|}|%|\"|$|'|`).*/", $web-docroot)){
throw new lxexception("folder_name_may_not_contain_bad_characters","");
}

///#656 When adding a subdomain, the Document Root field is not being validated
if (csa($web->docroot, " /")) {
Expand Down
3 changes: 3 additions & 0 deletions kloxo/httpdocs/lib/domain/web/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,9 @@ function updateform($subaction, $param)
if(preg_match("/\.\.\//", $param['docroot'])) {
throw new lxexception("folder_name_may_not_contain_doubledotsslash", "");
}
if(preg_match("/.*({|}|%|\"|$|'|`).*/", $web-docroot)){
throw new lxexception("folder_name_may_not_contain_bad_characters","");
}
return $vlist;

case "blockip":
Expand Down

0 comments on commit c09edab

Please sign in to comment.