apache / apache/shenyu

[BUG] PluginJarParser.parseJar NPE on missing/incomplete pom.properties

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

Description

- Severity: High
- Location:
`shenyu-web/src/main/java/org/apache/shenyu/web/loader/PluginJarParser.java:60-62`
-
Description:
`pluginJar.version = properties.get("version").toString(); pluginJar.artifactId = properties.get("artifactId").toString(); pluginJar.groupId = properties.get("groupId").toString();`. `Properties.get` returns `null` if the key is absent (hand-crafted jar, stripped `pom.properties`, or a `pom.xml`-only jar). `.toString()` on null → `NullPointerException`. If no `pom.properties` exists at all, `version`/`artifactId`/`groupId` stay null and `getJarKey()` returns `"null:null"`, colliding all such plugins into one cache slot.
-
Impact:
NPE aborts `parseJar`; in the upload path `ShenyuLoaderService.loadExtOrUploadPlugins` catches `Exception` broadly (line 94), so the whole load cycle silently fails with only a log line. Multi-plugin collisions on `"null:null"` corrupt the classloader cache.
-
Suggested fix:
Use `properties.getProperty(key, "")` with non-null defaults, or guard each `get(...)` with `Objects.requireNonNull` and throw a typed `ShenyuException` naming the jar/entry.
-
Confidence: High
- Related existing: none

---
_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 with shenyu-web/src/main/java/org/apache/shenyu/web/loader/PluginJarParser.java:60-62 and trace how missing or incomplete pom.properties values reach parseJar. Then inspect ShenyuLoaderService.loadExtOrUploadPlugins at line 94. Done means hand-crafted, stripped, and pom.xml-only jars no longer trigger an NPE or cause indistinguishable null:null plugin cache entries.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.