apache / apache/shenyu

[BUG] ResourceController.updateResource bypasses all bean validation (@Valid missing on @RequestBody)

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

Description

- severity: High
- files: `shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ResourceController.java:152`
- description: `createResource` (line 136) uses `@Valid @RequestBody final CreateResourceDTO`, but `updateResource` (line 152) uses only `@RequestBody final ResourceDTO resourceDTO` with no `@Valid`. `ResourceDTO` declares 11 constraints (`@NotBlank` on parentId/title/name/url/component/icon/perms; `@NotNull` on resourceType/sort/isLeaf/isRoute/status). None are enforced on the update path.
- impact: An authenticated user with `system:resource:editMenu`/`editButton` can update a resource with empty/null required fields, corrupting the menu/permission tree and potentially breaking RBAC enforcement (perms drives authorization checks).
- suggested_fix: Add `@Valid` to the `@RequestBody` parameter on line 152, mirroring `createResource`.
- confidence: High
- related_existing: none — distinct from GOV-T1 (zero-test controllers) and SEC-13 (AppAuthVO plaintext).

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/00-consolidated-critical-high.md`](docs/scan2-2026-08-02/00-consolidated-critical-high.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Read shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ResourceController.java around lines 136 and 152, comparing the createResource and updateResource parameter annotations. Verify that updateResource applies the same validation behavior to ResourceDTO as createResource, including its declared required-field constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, authorization, backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.