arshilkxwork opened a new pull request, #3334: URL: https://github.com/apache/hugegraph/pull/3334
Fixes #3285. `auth.admin_pa` is read through commons-configuration's properties reader. It trims the value, processes backslash escapes and decodes the file as ISO-8859-1, so ` padded `, `two\\back` or `pässword` can end up as a different admin password from the one the operator set. This adds `auth.admin_pa_file`. It points at a file that the Server reads as raw UTF-8, dropping one trailing `\n` or `\r\n` so files written by `echo` or a secret mount work as expected. `auth.admin_pa` stays as it is for compatibility. When the file option is set it is used on all three bootstrap paths: - the PD startup path (`GraphManager.loadMetaFromPD`), in place of `auth.admin_pa` - non-persistent backends (`GraphManager.checkBackendVersionOrExit`), in place of `auth.admin_pa` - `init-store` with a persistent backend, in place of the stdin prompt The reader refuses a missing, unreadable, empty or non-UTF-8 file with a `ConfigException` that names the option. It never falls back to `auth.admin_pa` or the `pa` default, because that would create an admin whose password nobody chose. The non-UTF-8 case is refused for the same reason: guessing another charset is how `pässword` became `pässword` in the first place. When `init_store.enabled=false`, the existing check in `InitStore.checkAdminBootstrapReachable` now accepts the file option as an explicit password and reads it right away, so a bad path fails before the Server starts rather than during PD bootstrap. `initialAdminPassword` and `readAdminPasswordFile` are added to the Gremlin reflection filter next to `initAdminUser` and `inputPassword`. Docs: `docker/README.md` and the commented example in the shipped `rest-server.properties`. The Docker entrypoint already encodes `PASSWORD` safely since #3327, so it is unchanged. The website config-option table in `apache/hugegraph-doc` also lists `auth.admin_pa` and needs a matching entry; the paired doc PR will be linked here. Left for a follow-up: the Helm chart still refuses padded, backslash and non-ASCII admin passwords. Relaxing that means switching its Server wrapper to mount the Secret and set `auth.admin_pa_file`, and it depends on the minimum Server image the chart supports, so it belongs in its own PR. The TODO in `ServerOptions` now says that. Tests: `AdminPasswordFileTest` covers precedence, the strings from the issue table, line-break handling and the three failure cases. Two new `InitStoreConfigTest` cases cover the disabled init-store check with a valid file and with a missing one. -- 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]
