You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(pd): validate REST credentials and return 401 on refusal (#3189)
PD's REST interceptor decodes the Basic credential, keeps only the part before the colon, and checks it against the fixed set hg, store, hubble, vermeer. Any of those names with any password, including an empty one, is treated as an internal component; the password is never read. Separately, RestAuthentication.preHandle writes an error body without calling setStatus, so success, refusal and missing credential all return HTTP 200 and nothing keyed on a status code (monitors, curl -f, the shipped healthchecks) can see a refusal. The endpoints behind the interceptor mutate the cluster: POST /v1/members/change, DELETE /v1/store/{storeId}, graph and graphspace writes, and the balance and patrol tasks. The issue has the measured 27-request matrix.
---------
Co-authored-by: imbajin <jin@apache.org>
Do not commit `.env`. Keeping the same JWT secret preserves authentication
48
-
tokens when containers are recreated. For authenticated topologies with
49
-
multiple Server replicas, all replicas receive this same secret. The HA
50
-
topology fails fast if authentication is enabled without this shared secret.
51
+
Do not commit `.env` or `conf/hubble/*.local.properties`; both are in `.gitignore`. Keeping the same JWT secret preserves authentication tokens when containers are recreated. For authenticated topologies with multiple Server replicas, all replicas receive this same secret. The HA topology fails fast if authentication is enabled without this shared secret.
51
52
52
-
A non-empty `HUGEGRAPH_ADMIN_PASSWORD` enables Server authentication, and
53
-
Hubble detects that mode automatically. Omitting the variable or setting it to
54
-
an empty value disables authentication. Auth-off is only suitable for a
55
-
trusted local environment; never expose it to a public or untrusted network.
56
-
Hubble listens on host loopback by default. Set `HUBBLE_PUBLISH_HOST` only
57
-
behind an HTTPS reverse proxy and trusted network controls.
53
+
A non-empty `HUGEGRAPH_ADMIN_PASSWORD` enables Server authentication, and Hubble detects that mode automatically. Omitting the variable or setting it to an empty value disables authentication. Auth-off is only suitable for a trusted local environment; never expose it to a public or untrusted network. Hubble listens on host loopback by default. Set `HUBBLE_PUBLISH_HOST` only behind an HTTPS reverse proxy and trusted network controls.
58
54
59
-
`HUGEGRAPH_ADMIN_PASSWORD` initializes the built-in `admin` account on its
60
-
first authenticated startup. Changing `.env` does not rotate an existing
61
-
administrator password; use the HugeGraph user API for credential changes.
55
+
`HUGEGRAPH_ADMIN_PASSWORD` initializes the built-in `admin` account on its first authenticated startup. Changing `.env` does not rotate an existing administrator password; use the HugeGraph user API for credential changes.
62
56
63
-
For the verification commands below, set the password in your current shell:
57
+
For the verification commands below, load `.env` into your current shell and set the password:
64
58
65
59
```bash
60
+
set -a;. ./.env;set +a
66
61
ADMIN_PASSWORD='the-same-password-used-in-.env'
67
62
```
68
63
64
+
The PD REST API (port 8620, HStore topologies only) requires HTTP Basic auth (`hg:${HG_PD_AUTH_SECRET_KEY}`) for all endpoints except health/readiness probes (`/v1/health`, `/v1/ready`). `HG_PD_AUTH_SECRET_KEY` is shared across PD, Server (`bin/wait-storage.sh`), and Hubble (`conf/hubble/*.local.properties` generated by `./set-hubble-pd-password.sh`).
- Pin `HUGEGRAPH_VERSION` to a release that carries the endpoint, or build the
224
-
images from source with `docker-compose.dev.yml`.
225
-
226
-
The `HEALTHCHECK` baked into `hugegraph-pd/Dockerfile` is `/v1/health` as well.
227
-
Both compose files override it, so it governs `docker run` and anything else
228
-
inheriting the image probe, and those keep reading a PD without a quorum as
229
-
healthy.
213
+
PD answers two unauthenticated probe endpoints: `/v1/health` for liveness (returns 200 once the REST listener is up, regardless of raft state), and `/v1/ready` for readiness (returns 200 only when PD sees a raft leader, 503 otherwise).
230
214
231
-
Open `http://localhost:8088` and sign in as `admin` with the password from
232
-
`.env`.
215
+
Compose healthchecks currently gate on `/v1/health` for compatibility with published images. When targeting readiness on newer releases or source builds (`docker-compose.dev.yml`), match on the response body (`curl -fsS http://localhost:8620/v1/ready | grep -q '"ready":true'`).
216
+
217
+
Open `http://localhost:8088` and sign in as `admin` with the password from `.env`.
The Hubble `latest` image is expected to work with HugeGraph Server 1.7 and
269
-
Server `latest`; compatibility with versions older than 1.7 is not promised.
270
-
Pin immutable image references when reproducibility is required.
253
+
The Hubble `latest` image is expected to work with HugeGraph Server 1.7 and Server `latest`; compatibility with versions older than 1.7 is not promised. Pin immutable image references when reproducibility is required.
The three small files under `conf/hubble/` contain only topology-specific
352
-
discovery settings and container paths:
334
+
The three small files under `conf/hubble/` contain only topology-specific discovery settings, the PD REST credential (`operations.pd.username` and `operations.pd.password`, which must match PD's `auth.secret-key`), and container paths:
353
335
354
336
-`conf/hubble/standalone.properties` uses direct Server mode.
355
-
-`conf/hubble/hstore.properties` uses one PD and one Store REST target.
356
-
-`conf/hubble/hstore-ha.properties` uses all three PD peers and all three
357
-
allowed Store REST targets.
337
+
-`conf/hubble/hstore.properties.example` uses one PD and one Store REST target.
338
+
-`conf/hubble/hstore-ha.properties.example` uses all three PD peers and all three allowed Store REST targets.
339
+
340
+
The two HStore topologies mount the generated `*.local.properties` next to these examples (see `set-hubble-pd-password.sh`), never the examples themselves, so the PD secret stays out of tracked files.
358
341
359
-
Hubble detects Server authentication through the Server API. Do not add an
360
-
`auth.enabled` property or duplicate auth-on/auth-off configurations.
342
+
Hubble detects Server authentication through the Server API. Do not add an `auth.enabled` property or duplicate auth-on/auth-off configurations.
361
343
362
344
### Render and smoke checks
363
345
@@ -367,12 +349,9 @@ Render every topology with auth-on inputs before submitting a change:
367
349
bash test-compose.sh render
368
350
```
369
351
370
-
The HA render is mandatory even when local resources are insufficient to start
371
-
its ten containers.
352
+
The HA render is mandatory even when local resources are insufficient to start its ten containers.
372
353
373
-
Run focused auth-on smoke checks for standalone and minimal HStore with the
374
-
corresponding `up -d --wait`, status, authentication, Hubble `/about`, and
375
-
`down -v` commands from the Users section:
354
+
Run focused auth-on smoke checks for standalone and minimal HStore with the corresponding `up -d --wait`, status, authentication, Hubble `/about`, and `down -v` commands from the Users section:
376
355
377
356
```bash
378
357
bash test-compose.sh smoke
@@ -384,6 +363,4 @@ Run the required local auth-off checks separately:
384
363
bash test-compose.sh smoke-auth-off
385
364
```
386
365
387
-
The auth-off mode is intentionally excluded from the default CI matrix and must
388
-
remain on a trusted local machine. Both smoke modes remove only the isolated
389
-
Compose projects and volumes that they create.
366
+
The auth-off mode is intentionally excluded from the default CI matrix and must remain on a trusted local machine. Both smoke modes remove only the isolated Compose projects and volumes that they create.
0 commit comments