Fix parsing of SONARQUBE_EXTRA_PROPERTIES and SONARQUBE_SMTP_* variables (#31116)

* Fix parsing of SONARQUBE_EXTRA_PROPERTIES.

The existing code is not able to deal with values that include equal
signs. To configure SAML via the extra properties mechanism, a
certificate is required, which can include equal signs as part of the
base64 padding.

Signed-off-by: Philip Stark <git@codechaos.ch>

* Fix parsing of SMTP parameters when inserting into database

The SONARQUBE_SMTP_PASSWORD or SONARQUBE_SMTP_USER could contain equal
signs, which would then lead to an insertion of an incorrect key.

Signed-off-by: Philip Stark <git@codechaos.ch>

---------

Signed-off-by: Philip Stark <git@codechaos.ch>
This commit is contained in:
P Stark
2023-04-21 16:44:43 +02:00
committed by GitHub
parent 4ac3a5ac79
commit caee267a0d
4 changed files with 6 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \
org.opencontainers.image.created="2023-04-18T11:47:12Z" \
org.opencontainers.image.description="Application packaged by VMware, Inc" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="10.0.0-debian-11-r0" \
org.opencontainers.image.ref.name="10.0.0-debian-11-r1" \
org.opencontainers.image.title="sonarqube" \
org.opencontainers.image.vendor="VMware, Inc." \
org.opencontainers.image.version="10.0.0"

View File

@@ -133,7 +133,7 @@ sonarqube_initialize() {
if [[ "${#additional_properties[@]}" -gt 0 ]]; then
info "Adding properties provided via SONARQUBE_EXTRA_PROPERTIES to sonar.properties"
for property in "${additional_properties[@]}"; do
sonarqube_conf_set "${property%=*}" "${property#*=}"
sonarqube_conf_set "${property%%=*}" "${property#*=}"
done
fi
@@ -186,7 +186,7 @@ EOF
unix_timestamp_ms="$(date '+%s%N' | cut -b1-13)"
for setting in "${settings_to_update[@]}"; do
postgresql_remote_execute "${postgresql_execute_args[@]}" <<EOF
INSERT INTO properties (uuid, prop_key, is_empty, text_value, created_at) VALUES ('$(generate_random_string -t alphanumeric -c 20)', '${setting%=*}', '0', '${setting#*=}', '${unix_timestamp_ms}');
INSERT INTO properties (uuid, prop_key, is_empty, text_value, created_at) VALUES ('$(generate_random_string -t alphanumeric -c 20)', '${setting%%=*}', '0', '${setting#*=}', '${unix_timestamp_ms}');
EOF
done
fi

View File

@@ -7,7 +7,7 @@ LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \
org.opencontainers.image.created="2023-04-17T16:59:26Z" \
org.opencontainers.image.description="Application packaged by VMware, Inc" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="9.9.0-debian-11-r23" \
org.opencontainers.image.ref.name="9.9.0-debian-11-r24" \
org.opencontainers.image.title="sonarqube" \
org.opencontainers.image.vendor="VMware, Inc." \
org.opencontainers.image.version="9.9.0"

View File

@@ -133,7 +133,7 @@ sonarqube_initialize() {
if [[ "${#additional_properties[@]}" -gt 0 ]]; then
info "Adding properties provided via SONARQUBE_EXTRA_PROPERTIES to sonar.properties"
for property in "${additional_properties[@]}"; do
sonarqube_conf_set "${property%=*}" "${property#*=}"
sonarqube_conf_set "${property%%=*}" "${property#*=}"
done
fi
@@ -186,7 +186,7 @@ EOF
unix_timestamp_ms="$(date '+%s%N' | cut -b1-13)"
for setting in "${settings_to_update[@]}"; do
postgresql_remote_execute "${postgresql_execute_args[@]}" <<EOF
INSERT INTO properties (uuid, prop_key, is_empty, text_value, created_at) VALUES ('$(generate_random_string -t alphanumeric -c 20)', '${setting%=*}', '0', '${setting#*=}', '${unix_timestamp_ms}');
INSERT INTO properties (uuid, prop_key, is_empty, text_value, created_at) VALUES ('$(generate_random_string -t alphanumeric -c 20)', '${setting%%=*}', '0', '${setting#*=}', '${unix_timestamp_ms}');
EOF
done
fi