Просмотр исходного кода

Update docker/entrypoint.sh

Co-authored-by: qodo-merge-for-open-source[bot] <189517486+qodo-merge-for-open-source[bot]@users.noreply.github.com>
sstidl 1 день назад
Родитель
Сommit
64e4c3b768
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      docker/entrypoint.sh

+ 6 - 2
docker/entrypoint.sh

@@ -79,8 +79,12 @@ if [[ "$TELEMETRY" == "true" && ("$MODE" == "frontend" || "$MODE" == "standalone
   if [ "$ENABLE_ID_OBFUSCATION" == "true" ]; then
     sed -i s/\$enable_id_obfuscation\ =\ .*\;/\$enable_id_obfuscation\ =\ true\;/g /var/www/html/results/telemetry_settings.php
     if [ ! -z "$OBFUSCATION_SALT" ]; then
-      echo "<?php" > /var/www/html/results/idObfuscation_salt.php
-      echo "\$OBFUSCATION_SALT = $OBFUSCATION_SALT;" >> /var/www/html/results/idObfuscation_salt.php
+      if [[ "$OBFUSCATION_SALT" =~ ^0x[0-9a-fA-F]+$ ]]; then
+        echo "<?php" > /var/www/html/results/idObfuscation_salt.php
+        echo "\$OBFUSCATION_SALT = $OBFUSCATION_SALT;" >> /var/www/html/results/idObfuscation_salt.php
+      else
+        echo "WARNING: Invalid OBFUSCATION_SALT format. It must be a hex string (e.g., 0x1234abcd). Using random salt." >&2
+      fi
     fi
   fi