From fd06e94de39c0533e601d028deccd1843ab209e7 Mon Sep 17 00:00:00 2001 From: Michael Kanchuker Date: Thu, 16 Oct 2025 19:52:24 +0300 Subject: [PATCH 1/2] feat: allow to specify obfuscation salt string --- doc_docker.md | 1 + docker/entrypoint.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/doc_docker.md b/doc_docker.md index 2ee4de3..cf249fe 100755 --- a/doc_docker.md +++ b/doc_docker.md @@ -59,6 +59,7 @@ Here's a list of additional environment variables available in this mode: * __`TITLE`__: Title of your speed test. Default value: `LibreSpeed` * __`TELEMETRY`__: Whether to enable telemetry or not. If enabled, you maybe want your data to be persisted. See below. Default value: `false` * __`ENABLE_ID_OBFUSCATION`__: When set to true with telemetry enabled, test IDs are obfuscated, to avoid exposing the database internal sequential IDs. Default value: `false` +* __`OBFUSCATION_SALT`__: The salt string that is used to obfuscate the test IDs. The format shoud be a 2 byte hex string (e.g. `0x1234abcd`). If not specified, a random one will be generated. * __`REDACT_IP_ADDRESSES`__: When set to true with telemetry enabled, IP addresses and hostnames are redacted from the collected telemetry, for better privacy. Default value: `false` * __`DB_TYPE`__: When set to one of the supported DB-Backends it will use this instead of the default sqlite database backend. TELEMETRY has to be set to `true`. Also you have to create the database as described in [doc.md](doc.md#creating-the-database). Supported backend types are: * sqlite - no additional settings required diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 5414eae..25052cb 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -78,6 +78,10 @@ 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 " /var/www/html/results/idObfuscation_salt.php + echo "\$OBFUSCATION_SALT = $OBFUSCATION_SALT;" >> /var/www/html/results/idObfuscation_salt.php + fi fi if [ "$REDACT_IP_ADDRESSES" == "true" ]; then From 64e4c3b768346797392b675c05f40c6ee4b1ddc3 Mon Sep 17 00:00:00 2001 From: sstidl Date: Sat, 18 Oct 2025 11:34:14 +0200 Subject: [PATCH 2/2] Update docker/entrypoint.sh Co-authored-by: qodo-merge-for-open-source[bot] <189517486+qodo-merge-for-open-source[bot]@users.noreply.github.com> --- docker/entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 25052cb..6a15f29 100755 --- a/docker/entrypoint.sh +++ b/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 " /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 " /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