Skip to content

Commit 1e98096

Browse files
authored
Fix/xss vulnrebility (hestiacp#4013)
* Fix XSS in edit server and add package * Also update RHEL templates for Gitea
1 parent 5022569 commit 1e98096

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

install/rpm/templates/web/nginx/php-fpm/gitea.stpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ server {
2424

2525
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
2626

27-
location ~ /.well-known {
28-
allow all;
27+
location ~ /\.(?!well-known\/) {
28+
deny all;
29+
return 404;
2930
}
3031

3132
location / {

install/rpm/templates/web/nginx/php-fpm/gitea.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ server {
1515
1616
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
1717
18-
location ~ /.well-known {
19-
allow all;
18+
location ~ /\.(?!well-known\/) {
19+
deny all;
20+
return 404;
2021
}
2122

2223
location / {

web/edit/server/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,9 @@
358358
$return_var,
359359
);
360360
check_return_code($return_var, $output);
361-
$v_timezone = $_POST["v_timezone"];
361+
if (in_array($_POST["v_timezone"], $v_timezones)) {
362+
$v_timezone = $_POST["v_timezone"];
363+
}
362364
unset($output);
363365
}
364366
}

web/templates/includes/js.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
NOTIFICATIONS_EMPTY: '<?= _("No notifications") ?>',
1010
NOTIFICATIONS_DELETE_ALL: '<?= _("Delete all notifications") ?>',
1111
CONFIRM_LEAVE_PAGE: '<?= _("Are you sure you want to leave the page?") ?>',
12-
ERROR_MESSAGE: '<?= !empty($_SESSION["error_msg"]) ? htmlentities($_SESSION["error_msg"]) : "" ?>',
12+
ERROR_MESSAGE: '<?= !empty($_SESSION["error_msg"]) ? htmlentities($_SESSION["error_msg"],ENT_QUOTES) : "" ?>',
1313
BLACKLIST: '<?= _("BLACKLIST") ?>',
1414
IPVERSE: '<?= _("IPVERSE") ?>'
1515
});

web/templates/pages/add_package.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ class="fas icon-dim icon-maroon js-section-toggle-icon"
117117
<select class="form-select" name="v_backend_template" id="v_backend_template">
118118
<?php
119119
foreach ($backend_templates as $key => $value) {
120-
echo $v_backend_template;
121120
echo "\t\t\t\t<option value=\"".$value."\"";
122121
if ((!empty($v_backend_template)) && ( $value == trim($v_backend_template, "'"))){
123122
echo ' selected' ;

0 commit comments

Comments
 (0)