apache / apache/shenyu

[BUG] SofaProxyService casts null RPC result placeholder to GenericObject

Open Beginner friendly
#6,739 1 comment 0 reactions 0 assignees View on GitHub
plugin: sofa 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-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java:95-113`
- description: When `ret` is null, the code sets `result = Constants.SOFA_RPC_RESULT_EMPTY` (a `String`), then immediately does `GenericObject genericObject = (GenericObject) result;`. Casting the placeholder `String` to `GenericObject` throws `ClassCastException` → `ShenyuException` 500.
- impact: Any sofa RPC method that returns null yields a 500 instead of an empty success response.
- suggested_fix: Only cast to `GenericObject` when `result` is non-null and actually a `GenericObject`.
- confidence: High
- related_existing: none

---
_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-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java:95-113 and trace the null `ret` branch. Verify that a null SOFA RPC result no longer causes a `GenericObject` cast failure, and that the request produces an empty success response instead of a 500.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.