mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
add sanitize html types
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/sanitize-html": "^2.9.5",
|
||||
"concurrently": "^7.1.0",
|
||||
"nodemon": "^2.0.15",
|
||||
"oclif": "^3",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Request, Response, NextFunction } from 'express'
|
||||
const sanitizeHtml = require('sanitize-html')
|
||||
import sanitizeHtml from 'sanitize-html'
|
||||
|
||||
export function sanitizeMiddleware(req: Request, res: Response, next: NextFunction): void {
|
||||
// decoding is necessary as the url is encoded by the browser
|
||||
const decodedURI = decodeURI(req.url)
|
||||
req.url = sanitizeHtml(decodedURI)
|
||||
for (let p in req.query) {
|
||||
req.query[p] = sanitizeHtml(req.query[p])
|
||||
req.query[p] = sanitizeHtml(req.query[p] as string)
|
||||
}
|
||||
|
||||
next()
|
||||
|
||||
Reference in New Issue
Block a user