apache / apache/shenyu

[BUG] ShenyuClientHttpRegistryController: all six register/offline @RequestBody endpoints lack @Valid

Open
#6,713 1 comment 0 reactions 0 assignees View on GitHub
admin priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: Medium
- files: `shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ShenyuClientHttpRegistryController.java:61,77,93,106,122,138`
- description: All six mutating endpoints (`registerMetadata`, `registerURI`, `registerApiDoc`, `registerDiscoveryConfig`, `registerMcpTools`, `offline`) take `@RequestBody` without `@Valid`, and the register DTOs carry no bean-validation annotations. Required fields like `appName`, `rpcType`, `host`, `contextPath` are never validated and are forwarded into the gateway registration pipeline as null. `registerApiDoc` (line 93) does not even default `namespaceId`.
- impact: A malformed or empty JSON body is accepted and published to the gateway, potentially creating metadata/URI/MCP records with null required fields that downstream services consume without null-checks, leading to NPEs or corrupt gateway config.
- suggested_fix: Add `@Valid` to each `@RequestBody` and add `@NotBlank`/`@NotNull` on required fields of the register DTOs.
- confidence: High
- related_existing: none — distinct from GOV-T1 (test coverage); this is a per-controller validation gap on externally-facing register endpoints.

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ShenyuClientHttpRegistryController.java at lines 61, 77, 93, 106, 122, and 138, then locate the DTOs used by these six request bodies. Review which fields are required and how registerApiDoc handles namespaceId. Done means malformed bodies are rejected before reaching the gateway registration pipeline while valid registrations continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.