Skip to content

feat: support secure Hubble monitoring targets#3094

Closed
imbajin wants to merge 3 commits into
apache:masterfrom
imbaGeek:cdx/hubble-monitoring-pd-secret-redaction
Closed

feat: support secure Hubble monitoring targets#3094
imbajin wants to merge 3 commits into
apache:masterfrom
imbaGeek:cdx/hubble-monitoring-pd-secret-redaction

Conversation

@imbajin

@imbajin imbajin commented Jul 14, 2026

Copy link
Copy Markdown
Member

Purpose

Provide the small HugeGraph Server and PD compatibility boundaries required by Hubble native monitoring while keeping existing authentication and discovery behavior intact.

Changes

  • exclude PDConfig.secretKey from generated log output without changing authentication access
  • add StoreStatistics.restAddress, derived from the registered Store host and validated rest.port, with IPv4/hostname/IPv6 handling
  • share REST-address construction with service discovery while preserving its legacy fallback
  • propagate only explicitly configured schema.cache_capacity and serializer.buffer_max_capacity into PD graph configs, preserving caller/PD values

Verification

  • PD targeted tests: 7/7; PD REST suite: 15/15
  • Server unit suite: 583 tests, 0 failures, 0 errors, 1 skipped
  • checkstyle, RAT, package/distribution, and git diff --check passed
  • real 1.7.0 PD/Store/Server stack: PD formed a Leader, Store re-registered, /v1/stores returned the validated REST authority, Prometheus target discovery remained available, and four Server graphs started with the explicit cache limits
  • independent read-only review found no unresolved high- or medium-severity issue

This is intentionally limited to compatibility, secret redaction, and bounded local test configuration support; it does not add an alerting engine or production sizing policy.

imbajin added 3 commits July 14, 2026 14:09
- exclude the PD secret key from generated toString output
- preserve secret access for authentication behavior
- cover the logging boundary in the PD core test suite
- derive the REST authority from the registered host and rest.port label
- share IPv4 and IPv6 validation with service discovery
- preserve the legacy discovery fallback for missing labels
- cover additive DTO output and malformed address handling
- propagate explicit schema and serializer limits to PD graph configs
- preserve values supplied by PD or callers with putIfAbsent
- exclude aliases, implicit defaults, and unrelated sensitive settings
- cover propagation and compatibility in the server unit suite
Copilot AI review requested due to automatic review settings July 14, 2026 06:10
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. feature New feature pd PD module tests Add or improve test cases labels Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds compatibility and security improvements to support Hubble’s native monitoring targets across HugeGraph Server and PD, while preserving existing authentication and service-discovery fallback behavior.

Changes:

  • Redacts PDConfig.secretKey from toString() output while keeping runtime access intact.
  • Introduces validated Store REST target derivation (rest.port label + store host) with IPv4/hostname/IPv6 handling and shares the logic with service discovery (with legacy fallback).
  • Ensures only explicitly configured schema.cache_capacity and serializer.buffer_max_capacity are propagated into PD graph configs, without overriding values provided by PD/callers.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java Registers the new GraphManagerConfigTest in the server unit suite.
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/GraphManagerConfigTest.java Adds unit coverage for explicitly attaching local cache/buffer limits and preserving caller configs.
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java Attaches schema.cache_capacity and serializer.buffer_max_capacity only when explicitly configured locally.
hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/util/StoreRestAddressUtilTest.java Adds tests for REST address construction/validation across IPv4/IPv6/URI forms and invalid inputs.
hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/rest/StoreAPIStoreStatisticsTest.java Verifies StoreStatistics.restAddress exposure behavior via the REST API model.
hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/rest/PDRestSuiteTest.java Includes the new REST-oriented tests in the PD REST suite.
hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/core/PDCoreSuiteTest.java Includes PDConfigTest in the PD core suite.
hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/core/PDConfigTest.java Adds coverage to ensure PDConfig.toString() doesn’t leak the secret key.
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/util/StoreRestAddressUtil.java Introduces a shared, validated REST-address derivation helper for Store registrations.
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/SDConfigService.java Uses the shared REST-address derivation with a legacy gRPC-address fallback.
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/StoreAPI.java Exposes the derived REST address on StoreStatistics.
hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java Excludes secretKey from Lombok-generated toString().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@imbajin

imbajin commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Closing because this change was opened at the wrong publication stage. It must first be based on and reviewed in the hugegraph/hugegraph repository; an Apache upstream PR will only be considered after that review and CI are complete.

@imbajin imbajin closed this Jul 14, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in HugeGraph PD-Store Tasks Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature pd PD module size:L This PR changes 100-499 lines, ignoring generated files. tests Add or improve test cases

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants