mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Bugfix/Regex check for auth middleware (#2469)
add regex check for auth middleware
This commit is contained in:
@@ -140,8 +140,8 @@ export class App {
|
|||||||
'/api/v1/ip'
|
'/api/v1/ip'
|
||||||
]
|
]
|
||||||
this.app.use((req, res, next) => {
|
this.app.use((req, res, next) => {
|
||||||
if (req.url.includes('/api/v1/')) {
|
if (/\/api\/v1\//i.test(req.url)) {
|
||||||
whitelistURLs.some((url) => req.url.includes(url)) ? next() : basicAuthMiddleware(req, res, next)
|
whitelistURLs.some((url) => new RegExp(url, 'i').test(req.url)) ? next() : basicAuthMiddleware(req, res, next)
|
||||||
} else next()
|
} else next()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ const logger = createLogger({
|
|||||||
* this.app.use(expressRequestLogger)
|
* this.app.use(expressRequestLogger)
|
||||||
*/
|
*/
|
||||||
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
||||||
const unwantedLogURLs = ['/api/v1/node-icon/']
|
const unwantedLogURLs = ['/api/v1/node-icon/', '/api/v1/components-credentials-icon/']
|
||||||
if (req.url.includes('/api/v1/') && !unwantedLogURLs.some((url) => req.url.includes(url))) {
|
if (/\/api\/v1\//i.test(req.url) && !unwantedLogURLs.some((url) => new RegExp(url, 'i').test(req.url))) {
|
||||||
const fileLogger = createLogger({
|
const fileLogger = createLogger({
|
||||||
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
||||||
defaultMeta: {
|
defaultMeta: {
|
||||||
|
|||||||
Reference in New Issue
Block a user