Skip to content

Commit fc1f1b0

Browse files
committed
remove xargs vulnerability
Signed-off-by: YuChen <[email protected]>
1 parent bf8dbbf commit fc1f1b0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

velero/schedule/common-service-db/cs-db-br-script-cm-4.6.10.4.11.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,26 +125,27 @@ data:
125125
CLUSTER_DOMAIN=$(oc get cm ibmcloud-cluster-info -n $CSDB_NAMESPACE -o jsonpath='{.data.cluster_address}' 2>/dev/null || echo "")
126126
127127
if [[ -z $CLUSTER_DOMAIN ]]; then
128-
error "Could not determine cluster domain from ibmcloud-cluster-info configmap. Please update IDP configuration manually."
128+
error "Could not determine cluster domain from ibmcloud-cluster-info configmap. Please update IDP configuration manually."
129129
return 1
130130
fi
131131
132-
info "Detected cluster domain: $CLUSTER_DOMAIN"
132+
info "Detected cluster domain: $CLUSTER_DOMAIN"
133133
134134
NEW_IDP_URL="https://${CLUSTER_DOMAIN}/idprovider/v1/auth"
135135
136-
info "Target IDP URL: $NEW_IDP_URL"
136+
info "🎯 Target IDP URL: $NEW_IDP_URL"
137137
138138
# Check if account_iam database exists
139139
ACCOUNT_IAM_EXISTS=$(oc -n $CSDB_NAMESPACE exec -t $CNPG_PRIMARY_POD -c postgres -- psql -U postgres -c "\list" | grep "account_iam" || echo False)
140140
141141
if [[ $ACCOUNT_IAM_EXISTS != "False" ]]; then
142142
# Check current IDP configuration
143-
CURRENT_IDP=$(oc -n $CSDB_NAMESPACE exec -t $CNPG_PRIMARY_POD -c postgres -- psql -U postgres -d account_iam -t -c "SELECT DISTINCT idp FROM accountiam.idp_config WHERE idp LIKE '%/idprovider/v1/%' LIMIT 1;" | xargs || echo "")
143+
CURRENT_IDP=$(oc -n $CSDB_NAMESPACE exec -t $CNPG_PRIMARY_POD -c postgres -- psql -U postgres -d account_iam -t -c "SELECT TRIM(idp) FROM accountiam.idp_config WHERE idp LIKE '%/idprovider/v1/%' LIMIT 1;" 2>/dev/null | head -n1 | tr -d '\r\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' || echo "")
144+
info "🌐 Current IDP URL: $CURRENT_IDP"
145+
echo ""
144146
145147
if [[ -n $CURRENT_IDP ]] && [[ $CURRENT_IDP != $NEW_IDP_URL ]]; then
146-
info "Current IDP URL: $CURRENT_IDP"
147-
info "Updating IDP configuration..."
148+
info "🔄 Updating IDP configuration..."
148149
149150
oc -n $CSDB_NAMESPACE exec -t $CNPG_PRIMARY_POD -c postgres -- psql -U postgres -d account_iam -c "
150151
UPDATE accountiam.idp_config
@@ -162,7 +163,7 @@ data:
162163
163164
success "IDP configuration updated successfully in account_iam database."
164165
elif [[ $CURRENT_IDP == $NEW_IDP_URL ]]; then
165-
info "IDP configuration already matches target URL, no update needed."
166+
info "IDP configuration already matches target URL, no update needed."
166167
else
167168
info "No IDP configuration found in database, skipping update."
168169
fi

0 commit comments

Comments
 (0)