mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-01-26 22:37:09 -05:00
fix: make sure that stripping backslashes for notification urls cannot cause catastophic backtracking (ReDOS) (#5573)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
7dc6191b0a
commit
7a9191761d
@ -11,7 +11,8 @@ class PushDeer extends NotificationProvider {
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
const serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com";
|
||||
const url = `${serverUrl.trim().replace(/\/*$/, "")}/message/push`;
|
||||
// capture group below is nessesary to prevent an ReDOS-attack
|
||||
const url = `${serverUrl.trim().replace(/([^/])\/+$/, "$1")}/message/push`;
|
||||
|
||||
let valid = msg != null && monitorJSON != null && heartbeatJSON != null;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Whapi extends NotificationProvider {
|
||||
"body": msg,
|
||||
};
|
||||
|
||||
let url = (notification.whapiApiUrl || "https://gate.whapi.cloud/").replace(/\/+$/, "") + "/messages/text";
|
||||
let url = (notification.whapiApiUrl || "https://gate.whapi.cloud/").replace(/([^/])\/+$/, "$1") + "/messages/text";
|
||||
|
||||
await axios.post(url, data, config);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user