imbajin commented on code in PR #3322:
URL: https://github.com/apache/hugegraph/pull/3322#discussion_r4265745471


##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##########
@@ -109,6 +109,28 @@ migrate_env() {
 
 migrate_env "BACKEND"  "HG_SERVER_BACKEND"
 migrate_env "PD_PEERS" "HG_SERVER_PD_PEERS"
+migrate_env "SERVICE_ID" "HG_SERVER_SERVICE_ID"
+migrate_env "GRAPH_SPACE" "HG_SERVER_GRAPHSPACE"
+
+# The Server reads these properties as ISO-8859-1. Reject unsupported input
+# before writing UTF-8 bytes that would select a different service identity.
+for identity_name in HG_SERVER_SERVICE_ID HG_SERVER_GRAPHSPACE; do
+    if [[ -n "${!identity_name:-}" ]] &&
+       (( $(printf '%s' "${!identity_name}" | LC_ALL=C tr -d '\040-\176' | wc 
-c) > 0 )); then

Review Comment:
   ⚠️ Important. Blocking: yes. Summary: This accepts printable IDs that 
`GraphManager.serviceId()` collapses before registering them with PD. In the 
same graph space, `Foo` and `foo` both produce `default-oltp-foo`; 
`analytics_prod` and `analytics-prod` also collide because the Server replaces 
`_` with `-` and lowercases the value. Both registrations then carry the same 
`SERVICE_ID` label, so a PD query for that identity returns endpoints from both 
deployments. Evidence: `GraphManager.registerService()` sets `SERVICE_ID` from 
`service.serviceId()`, and `DiscoveryMetaStore.labelMatch()` uses exact label 
equality. Please make the identity mapping injective or reject non-canonical 
values here and in the Helm schema, and keep the legacy `SERVICE_ID` mapping 
under the same validation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to