Aias00 opened a new issue, #6720:
URL: https://github.com/apache/shenyu/issues/6720
- Severity: Medium
- Location:
`shenyu-web/src/main/java/org/apache/shenyu/web/filter/CrossFilter.java:116-119`
-
Description:
The OPTIONS short-circuit `if (request.getMethod() == HttpMethod.OPTIONS) {
response.setStatusCode(HttpStatus.OK); return Mono.empty(); }` is inside the
`if (CorsUtils.isCorsRequest(request))` block but **outside** the `if
(allowCors)` block (which ends at line 115). So when the origin is **not**
allowed (`allowCors == false`), no CORS headers are set, but OPTIONS still gets
`200 OK` + `Mono.empty()` — the filter chain is never called.
-
Impact:
OPTIONS preflight requests from disallowed origins bypass the entire filter
chain (auth, logging, rate-limiting). The `200 OK` is misleading. Security
filters positioned after CrossFilter (`@Order(-100)`) are bypassed for all CORS
OPTIONS requests.
-
Suggested fix:
Move the OPTIONS short-circuit inside the `if (allowCors)` block; for
disallowed origins, pass through to `chain.filter(exchange)` or return 403.
-
Confidence: High
- Related existing: SEC-16 covers `allowedOrigins("*")` in admin's
`WebConfiguration`, not this OPTIONS bypass logic.
---
_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)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]