[BUG] ComposableSignService.handleExchange silently discards the APP_PARAM header mutation
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- Severity: High
- Location:
`shenyu-plugin/shenyu-plugin-security/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/service/ComposableSignService.java:229`
-
Description:
After successful signature verification, `handleExchange` is meant to forward the configured `appParam` to the upstream as the `appParam` request header. The implementation does `.ifPresent(param -> exchange.getRequest().mutate().headers(httpHeaders -> httpHeaders.set(Constants.APP_PARAM, param)).build());`. `ServerHttpRequest.mutate()` returns a builder whose `.build()` produces a *new* `ServerHttpRequest` — but that built request is the lambda's return value and is thrown away by `ifPresent`. It is never stored back into the exchange, and `handleExchange` (return type `void`) never propagates a new exchange to the chain. `SignPlugin.doExecute` then calls `chain.execute(exchange)` on the original, unmutated exchange.
-
Impact:
The per-app `paramDataList`/`appParam` feature is completely non-functional: configured app parameters are computed and then dropped — the `appParam` header never reaches the upstream.
-
Suggested fix:
Directly mutate the original request's headers: `.ifPresent(param -> exchange.getRequest().getHeaders().set(Constants.APP_PARAM, param));` — or restructure `handleExchange` to return a mutated `ServerWebExchange` and have `SignPlugin` execute the chain on it.
-
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 at shenyu-plugin/shenyu-plugin-security/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/service/ComposableSignService.java:229 and inspect handleExchange, then follow SignPlugin.doExecute to understand which exchange reaches the chain. Verify the configured appParam is present in the upstream request after signature verification, and add or update focused sign-plugin coverage if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100