From d999dd741ec435b21d51393e798ee406cdc1cdc2 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 3 Dec 2024 12:12:34 +0100 Subject: [PATCH] fix: [postgres] support of extension names with ``.`` or ``-`` --- postgres/lib/common | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/postgres/lib/common b/postgres/lib/common index 20947b2..63d57df 100644 --- a/postgres/lib/common +++ b/postgres/lib/common @@ -91,7 +91,11 @@ db_install_extensions() { info "Installed postgis extensions on database '$dbname'." ;; *) - ddb -d "$dbname" < <(echo "CREATE EXTENSION IF NOT EXISTS $1;") || return 1 + if ! [[ "$1" =~ ^[0-9a-zA-Z_.-]+$ ]]; then + err "Invalid extension name: $1" + return 1 + fi + ddb -d "$dbname" < <(echo "CREATE EXTENSION IF NOT EXISTS \"$1\";") || return 1 info "Installed $1 extension on database '$dbname'." ;; esac