imbajin commented on code in PR #3327:
URL: https://github.com/apache/hugegraph/pull/3327#discussion_r4253455488
##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##########
@@ -75,6 +69,24 @@ set_prop() {
set_prop_encoded "$key" "$(encode_prop_value "$val")" "$file"
}
+# Auth values are strings, not typed/list options. Commons keeps escaped spaces
+# and trims a physical trailing space before detecting line continuation.
+encode_auth_prop_value() {
+ local value="$1" encoding=UTF-8
+ if (( $(printf '%s' "${value}" | LC_ALL=C tr -d '\000-\177' | wc -c) > 0
)); then
+ # Retain legacy byte values that the ISO-8859-1 reader already
accepted.
+ if ! printf '%s' "${value}" | iconv -f UTF-8 -t UTF-8 >/dev/null 2>&1;
then
+ encoding=ISO-8859-1
+ fi
+ # The Server properties reader is ISO-8859-1. Standard UTF-16 escapes
+ # preserve UTF-8 input, including supplementary characters and
backslashes.
+ printf '%s' "${value}" | iconv -f "${encoding}" -t UTF-16BE | od -An
-v -tx1 | \
+ tr -d ' \n' | sed 's/..../\\u&/g'
+ else
+ encode_prop_value "${value}" | sed 's/\\ /\\u0020/g'
Review Comment:
Fixed. Boundary control bytes in authentication strings now use the existing
UTF-16 property escapes, preserving the exact value read by HugeConfig. Native
regressions cover leading/trailing controls, administrator password controls,
configuration reuse and an exact 32-byte signing key. The initializer also
retains its original locale; real Linux JSON login and same-data restart passed
without an encoding workaround.
##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##########
@@ -67,6 +67,27 @@ exit 0
EOF
chmod +x "${TEST_HOME}/bin/"*.sh
+# CI supplies current HugeConfig and the POM-pinned Commons dependency
classpath.
+if [[ -n "${HG_CONFIG_TEST_CLASSPATH:-}" ]]; then
Review Comment:
The shell test now prints an explicit SKIP when HG_CONFIG_TEST_CLASSPATH is
unset. The deployment-contracts path still supplies the current native reader
classpath; the final local verification actually ran HugeConfig/HS256 readback.
A skipped reader is not reported as native validation.
##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##########
@@ -26,13 +26,7 @@ mkdir -p "${DOCKER_FOLDER}"
log() { echo "[hugegraph-server-entrypoint] $*"; }
-# TODO: write values so the Server reads them back unchanged. A space is
escaped as "\ " here,
-# which java.util.Properties would unescape, but the Server reads these files
through Commons
-# Configuration's PropertiesConfiguration, which keeps the backslash before a
space: PASSWORD
-# "a b" becomes auth.admin_pa "a\ b" and the admin login with "a b" answers
401. Emit interior
-# spaces as-is (they round-trip) and add a write-then-read test through
HugeConfig for the keys
-# this script sets. The Helm chart (helm/hugegraph) refuses admin passwords
containing spaces in
-# its schema and Server wrapper; drop that guard once this is fixed.
+# Keep typed/list mappings on their existing encoder; auth strings use
native-reader escapes below.
Review Comment:
Kept the Helm guard and restored a one-line TODO tying its removal to the
chart minimum Server image containing this auth encoder. This preserves the
older-image compatibility boundary and does not claim that a fixed image has
already been released. The upgrade guide also distinguishes existing
administrator-password recovery from fresh initialization.
--
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]