From 06bedebce352cf7f9036a41a9f68b2d1235d9d2d Mon Sep 17 00:00:00 2001 From: RichardDorian Date: Wed, 8 Jul 2026 08:29:13 +0200 Subject: [PATCH] fix(storage): allow custom chown values in chown-storage-dir script --- plugins/storage/bin/chown-storage-dir | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/storage/bin/chown-storage-dir b/plugins/storage/bin/chown-storage-dir index 4be58586c..3ce7c5c7b 100755 --- a/plugins/storage/bin/chown-storage-dir +++ b/plugins/storage/bin/chown-storage-dir @@ -16,13 +16,15 @@ main() { exit 1 fi - case "$CHOWN_ID" in - 0 | 1000 | 2000 | 32767 | 165536 | 166536 | 167536 | 198303) ;; - *) - echo " ! Unsupported chown permissions. Supported values: 0, 1000, 2000, 32767 (and user namespace offset variants)" 1>&2 - exit 1 - ;; - esac + if [[ ! "$CHOWN_ID" =~ ^[0-9]+$ ]]; then + echo " ! Unsupported chown permissions. Value must be a non-negative integer." 1>&2 + exit 1 + fi + + if ((CHOWN_ID > 65535 && (CHOWN_ID < 165536 || CHOWN_ID > 231071))); then + echo " ! Unsupported chown permissions. Supported values: 0-65535 (and user namespace offset variants, 165536-231071)" 1>&2 + exit 1 + fi chown -R "$CHOWN_ID:$CHOWN_ID" "${DOKKU_LIB_ROOT}/data/storage/$DIRECTORY" }