apache / apache/shenyu

[BUG] NPE when metaData rpcExt is null or blank

Open Beginner friendly
#6,650 1 comment 0 reactions 0 assignees View on GitHub
plugin: grpc 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-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/GrpcPlugin.java:102-103`
- description: `GsonUtils.getGson().fromJson(metaData.getRpcExt(), GrpcExtInfo.class)` returns null `extInfo` when `rpcExt` is null/blank. Line 103 dereferences `extInfo.timeout` → NPE. `extInfo.methodType` (line 107) also null.
- impact: Any gRPC metadata registered without `rpcExt` causes an uncaught NPE.
- suggested_fix: Null-check `extInfo` after deserialization; supply a default `GrpcExtInfo`.
- confidence: High
- related_existing: none — #6490/#6492 are ingress parsing, not runtime plugin.

---
_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

Start in shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/GrpcPlugin.java at lines 102-103, and inspect GrpcExtInfo to understand the default values. Verify that metadata with a null or blank rpcExt no longer causes an NPE when timeout or methodType is accessed, then run the relevant gRPC plugin tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.