Skip to content

Commit 3c7d93f

Browse files
committed
Fix security issue with sed
1 parent 51f8b4f commit 3c7d93f

30 files changed

+433
-31
lines changed

bin/v-add-backup-host

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ EOF
104104
if [ "$type" != 'local' ];then
105105
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
106106
is_format_valid 'host' 'path' 'port'
107-
is_username_format_valid "$username" "username"
107+
is_type_valid "$type" 'sftp,ftp,b2'
108+
is_username_format_valid "$user" "username"
108109
is_password_valid
109110
format_no_quotes "$password" "password"
110111

bin/v-add-cron-job

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ is_object_unsuspended 'user' 'USER' "$user"
4444
is_package_full 'CRON_JOBS'
4545
get_next_cronjob
4646
is_format_valid 'job'
47+
is_format_valid 'restart'
4748
is_object_new 'cron' 'JOB' "$job"
4849

4950
# Perform verification if read-only mode is enabled

bin/v-add-dns-domain

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ if [ -z "$(is_ip_format_valid $domain)" ]; then
6666
exit 1
6767
fi
6868

69+
if [ -n "$restart" ]; then
70+
is_format_valid 'restart'
71+
fi
72+
6973
is_package_full 'DNS_DOMAINS'
7074
template=$(get_user_value '$DNS_TEMPLATE')
7175
is_dns_template_valid "$template"

bin/v-add-dns-record

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ is_object_new "dns/$domain" 'ID' "$id"
9696
is_dns_fqnd "$rtype" "$dvalue"
9797
is_dns_nameserver_valid "$domain" "$rtype" "$dvalue"
9898
is_format_valid 'ttl'
99+
if [ -n "$restart" ]; then
100+
is_format_valid 'restart'
101+
fi
99102

100103
# Perform verification if read-only mode is enabled
101104
check_hestia_demo_mode

bin/v-add-fastcgi-cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ source_conf "$HESTIA/conf/hestia.conf"
3131
#----------------------------------------------------------#
3232

3333
check_args '2' "$#" 'USER DOMAIN [DURATION] [DEBUG] [RESTART]'
34-
is_format_valid 'user' 'domain'
34+
is_format_valid 'user' 'domain' 'restart'
3535
is_object_valid 'user' 'USER' "$user"
3636
is_object_unsuspended 'user' 'USER' "$user"
3737
is_object_valid 'web' 'DOMAIN' "$domain"

bin/v-add-firewall-chain

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# Argument definition
1414
chain=$(echo $1 | tr '[:lower:]' '[:upper:]')
1515
port=$2
16+
port_ext=$2
1617
protocol=${4-TCP}
1718
protocol=$(echo $protocol|tr '[:lower:]' '[:upper:]')
1819

@@ -40,7 +41,7 @@ source_conf "$HESTIA/conf/hestia.conf"
4041
#----------------------------------------------------------#
4142

4243
check_args '1' "$#" 'CHAIN [PORT] [PROTOCOL]'
43-
is_format_valid 'chain'
44+
is_format_valid 'chain' 'port_ext' 'protocol'
4445
is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
4546

4647
# Perform verification if read-only mode is enabled

bin/v-add-mail-domain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ domain_utf=$(idn -t --quiet -u "$domain_idn")
4848
#----------------------------------------------------------#
4949

5050
check_args '2' "$#" 'USER DOMAIN [ANTISPAM] [ANTIVIRUS] [DKIM] [DKIM_SIZE]'
51-
is_format_valid 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size'
51+
is_format_valid 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size' 'restart'
5252
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
5353
is_object_valid 'user' 'USER' "$user"
5454
is_object_unsuspended 'user' 'USER' "$user"

bin/v-add-mail-domain-ssl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ is_web_domain_cert_valid
6363
# Perform verification if read-only mode is enabled
6464
check_hestia_demo_mode
6565

66+
if [ -n "$restart" ]; then
67+
is_format_valid "$restart"
68+
fi
6669
#----------------------------------------------------------#
6770
# Action #
6871
#----------------------------------------------------------#

bin/v-add-mail-domain-webmail

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if [ -z "$webmail" ]; then
6161
fi
6262

6363
check_args '2' "$#" 'USER DOMAIN [WEBMAIL] [RESTART]'
64-
is_format_valid 'user' 'domain'
64+
is_format_valid 'user' 'domain' 'restart'
6565
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
6666
is_system_enabled "$IMAP_SYSTEM" 'IMAP_SYSTEM'
6767
is_type_valid "$WEBMAIL_SYSTEM disabled" "$webmail"

bin/v-add-remote-dns-domain

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ source_conf "$HESTIA/conf/hestia.conf"
3232

3333
check_args '2' "$#" 'USER DOMAIN [FLUSH]'
3434
is_format_valid 'user' 'domain'
35+
if [ -n "$flush" ]; then
36+
is_type_valid "records yes no" "$flush"
37+
fi
3538
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
3639
is_procces_running
3740
remote_dns_health_check

0 commit comments

Comments
 (0)