mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Merge pull request #1368 from FlowiseAI/bugfix/XSS-array-query
Bugfix/Check for array query parameter
This commit is contained in:
@@ -6,8 +6,15 @@ export function sanitizeMiddleware(req: Request, res: Response, next: NextFuncti
|
|||||||
const decodedURI = decodeURI(req.url)
|
const decodedURI = decodeURI(req.url)
|
||||||
req.url = sanitizeHtml(decodedURI)
|
req.url = sanitizeHtml(decodedURI)
|
||||||
for (let p in req.query) {
|
for (let p in req.query) {
|
||||||
req.query[p] = sanitizeHtml(req.query[p] as string)
|
if (Array.isArray(req.query[p])) {
|
||||||
|
const sanitizedQ = []
|
||||||
|
for (const q of req.query[p] as string[]) {
|
||||||
|
sanitizedQ.push(sanitizeHtml(q))
|
||||||
|
}
|
||||||
|
req.query[p] = sanitizedQ
|
||||||
|
} else {
|
||||||
|
req.query[p] = sanitizeHtml(req.query[p] as string)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user