fix: symlink traversal

This commit is contained in:
aclist committed 2025-01-09 23:20:18 +09:00
1 parent 79b0bae05d
commit 923bac8f76
2 files changed
+15 -9

No files matched your search

+7 -4
View File
@@ -735,6 +735,9 @@ dump_servers(){
logger INFO "Server context is '$subcontext', reading from file '$file'"
filter_servers "$file" "$@"
}
redact(){
sed 's@\(/home/\)\([^/]*\)\(.*\)@\1REDACTED\3@g'
}
logger(){
local date="$(date "+%F %T,%3N")"
local tag="$1"
@@ -742,8 +745,8 @@ logger(){
local self="${BASH_SOURCE[0]}"
local caller="${FUNCNAME[1]}"
local line="${BASH_LINENO[0]}"
self="$(<<< "$self" sed 's@\(/[^/]*/\)\([^/]*\)\(.*\)@\1REDACTED\3@g')"
printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" >> "$debug_log"
printf "%s␞%s␞%s::%s()::%s␞%s\n" "$date" "$tag" "$self" "$caller" "$line" "$string" \
| redact >> "$debug_log"
}
test_ping(){
shift
@@ -1243,8 +1246,8 @@ symlinks(){
done
}
readarray -t mods < <(find $workshop_dir -mindepth 1 -name meta.cpp | awk -F/ 'NF=NF-1{print $NF}')
readarray -t links < <(find $game_dir -type l)
readarray -t mods < <(find "$workshop_dir" -mindepth 1 -name meta.cpp | awk -F/ 'NF=NF-1{print $NF}')
readarray -t links < <(find "$game_dir" -maxdepth 1 -type l)
if [[ ${#mods[@]} -eq 0 ]]; then
logger INFO "No mods present, aborting"