From 0e2b2e5a68f0e5a32bc4e7d869b475b744582643 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 17 May 2022 23:24:30 +0200 Subject: [PATCH] Disallow newlines in page names --- handlers/10_page.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/handlers/10_page.sh b/handlers/10_page.sh index b34aa1b..334df19 100755 --- a/handlers/10_page.sh +++ b/handlers/10_page.sh @@ -7,14 +7,6 @@ export WIKI_THEME=${WIKI_THEME:-default} . "$_EXEC/themes/${WIKI_THEME}.sh" -if [ "$(which awk)" ]; then - md() { awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk"; } -elif [ "$(which busybox)" ]; then - md() { busybox awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk"; } -else - md() { cat; } -fi - wiki() { # Print content of a wiki page # Get page from data or underlay dir, handle caching @@ -48,6 +40,11 @@ case "${PATH_INFO}" in FILE "${_EXEC}/${PATH_INFO#/\[.\]}" return 0 ;; + *${BR}*) + export ERROR_MSG='Page names containing newline character are not allowed' + theme_error 400 + return 0 + ;; */\#*) export ERROR_MSG='Page names starting with "#" are not allowed' theme_error 400 -- 2.39.2