From 5e60a88eeb3ce8cd9bc4eccbcd080c405fb2d3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Capil=C3=A9?= Date: Wed, 13 Nov 2024 06:26:48 -0300 Subject: [PATCH] $OIDC_SCOPES must be an array, testing the env to be a valid json array before pushing to config (without escaping) (#184) --- core/files/configure_misp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/files/configure_misp.sh b/core/files/configure_misp.sh index 0f96f27..1767cbb 100755 --- a/core/files/configure_misp.sh +++ b/core/files/configure_misp.sh @@ -101,13 +101,13 @@ set_up_oidc() { } }" > /dev/null - # Check if OIDC_SCOPES is set and not empty - if [[ -n "$OIDC_SCOPES" ]]; then + # Check if OIDC_SCOPES is set and is an array + if [[ "$(echo "$OIDC_SCOPES" | jq type -r)" == "array" ]]; then # Run the modify_config.php script to update OidcAuth configuration with the provided OIDC_SCOPES # The 'scopes' field will only be added if OIDC_SCOPES has a value sudo -u www-data php /var/www/MISP/tests/modify_config.php modify "{ \"OidcAuth\": { - ${OIDC_SCOPES:+\"scopes\": \"${OIDC_SCOPES}\"} + \"scopes\": ${OIDC_SCOPES} } }" > /dev/null fi