mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
ddns-scripts: sanitize host charset and shell escape characters
Since certain characters are dangerous to pass as-is to a sub shell, sanitize the character set and only allow characters that are considered valid for DNS hosts and filter shell escape characters on generic parameters. Disable pathname expansion on RUNPROG evals to disable the shell expanding *, ? and [ in the arguments. Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
This commit is contained in:
@@ -240,6 +240,15 @@ esac
|
||||
# without lookup host and possibly other required options we can do nothing for you
|
||||
[ -z "$lookup_host" ] && write_log 14 "Service section not configured correctly! Missing 'lookup_host'"
|
||||
|
||||
# verify validity of variables
|
||||
[ -n "$lookup_host" ] && sanitize_variable lookup_host "$DNS_CHARSET" ""
|
||||
[ -n "$dns_server" ] && sanitize_variable dns_server "$DNS_CHARSET" ""
|
||||
[ -n "$domain" ] && sanitize_variable domain "$DNS_CHARSET" ""
|
||||
|
||||
# Filter shell escape characters, if these are required in the URL, they
|
||||
# can still be passed url encoded
|
||||
[ -n "$param_opt" ] && sanitize_variable param_opt "" "$SHELL_ESCAPE"
|
||||
|
||||
[ -n "$update_url" ] && {
|
||||
# only check if update_url is given, update_scripts have to check themselves
|
||||
[ -z "$domain" ] && $(echo "$update_url" | grep "\[DOMAIN\]" >/dev/null 2>&1) && \
|
||||
|
||||
Reference in New Issue
Block a user