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
{{ message }}
Repository navigation
Java SDK naming registration should reject blank or invalid instance IPย #15305
When registering a naming instance through the public Java SDK, the SDK/gRPC path does not currently reject a blank instance IP with a controlled NacosException.
The HTTP OpenAPI path validates InstanceForm.ip as a required field and returns a parameter error for blank IP. However, the Java SDK registration path calls NamingUtils.checkInstanceIsLegal(instance), and that helper currently checks null instance, heartbeat metadata, and cluster-name format, but does not validate blank or malformed IP. The gRPC InstanceRequestHandler then passes the Instance to clientOperationService.registerInstance(...) without an equivalent required-IP validation.
Expected Behavior
Java SDK naming registration should reject blank or invalid instance IPs predictably, preferably with NacosException.INVALID_PARAM, and should align with the HTTP API validation contract where possible.
Actual Behavior
A Java SDK IT attempt using an Instance whose IP is blank did not receive the expected controlled parameter exception on the standalone SDK/gRPC path, so the scenario cannot be asserted as a stable IT contract yet.
Suggested Fix
Confirm the intended Java SDK contract, then add required-IP and malformed-IP validation either in the SDK-side instance validation or the server-side gRPC request validation path. After the behavior is fixed, add Java SDK IT coverage for blank and invalid IP registration failures.
Related Context
This was found while improving Java SDK integration-test scenario coverage under test/java-sdk-test. The invalid-IP IT scenario is intentionally documented as a gap until the contract is fixed.
Hi, I'd like to work on this. Quick summary to confirm the direction first:
The HTTP API already rejects a blank instance IP (InstanceForm.validate()), but the Java SDK path (NamingUtils.checkInstanceIsLegal, used by NacosNamingService.registerInstance) doesn't check the IP at all โ so a blank IP isn't rejected with a proper INVALID_PARAM.
I'd add a blank-IP check in NamingUtils.checkInstanceIsLegal to match the HTTP contract. I'd only check for blank (not IP format), since hostnames are valid and the HTTP side doesn't enforce a format either. Sound good? If so I'll send a PR with a regression test.
Activity
[ISSUE alibaba#15305] Fix legacy Admin API compatibility spec (alibabโฆ
daguimu commentedon Jun 5, 2026
Hi, I'd like to work on this. Quick summary to confirm the direction first:
The HTTP API already rejects a blank instance IP (InstanceForm.validate()), but the Java SDK path (NamingUtils.checkInstanceIsLegal, used by NacosNamingService.registerInstance) doesn't check the IP at all โ so a blank IP isn't rejected with a proper INVALID_PARAM.
I'd add a blank-IP check in NamingUtils.checkInstanceIsLegal to match the HTTP contract. I'd only check for blank (not IP format), since hostnames are valid and the HTTP side doesn't enforce a format either. Sound good? If so I'll send a PR with a regression test.
KomachiSion commentedon Jun 5, 2026
Thanks,
If check in
NamingUtils.checkInstanceIsLegalis ok.And more consider to check in InstanceRequestHandler, to avoid other programer language also leak the checks.
[ISSUE alibaba#15305] Reject blank instance IP on naming registration
[ISSUE alibaba#15305] Reject blank instance IP on naming registration
[ISSUE #15305] Reject blank instance IP in naming registration (#15454)
[ISSUE #15305] Reject blank instance IP in naming registration (#15454)