RockteMQ-AI opened a new pull request, #2633:
URL: https://github.com/apache/rocketmq-dashboard/pull/2633

   ## Problem
   
   `DashboardCollectServiceImpl.getBrokerCache(date)` and `getTopicCache(date)` 
construct file paths by direct string concatenation: `new File(dataLocationPath 
+ date + ".json")`. The `date` parameter originates from user input via 
`DashboardController` and is never validated, enabling directory traversal 
attacks (e.g., `../../xxx`).
   
   Fixes #2625
   
   ## Changes
   
   - Added `DATE_PATTERN` whitelist regex (`^\d{4}-\d{2}-\d{2}$`) matching the 
expected `yyyy-MM-dd` format
   - Added `checkDateParam()` method that throws `ServiceException(-1, ...)` 
for invalid date values
   - Called `checkDateParam(date)` at entry of both `getBrokerCache()` and 
`getTopicCache()`
   
   ## Verification
   
   - Valid dates (`2024-01-01`) continue to work normally
   - Invalid dates (`../../etc/passwd`, `abc`, `2024/01/01`) now return error 
responses
   - Single file change, minimal surface area


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

Reply via email to