From 855422a0257ec6f272448cbf478332a143322736 Mon Sep 17 00:00:00 2001 From: Shigma Date: Wed, 18 Sep 2024 00:04:22 +0800 Subject: [PATCH] fix(console): fix path regexp cve, close koishijs/koishi#1457 --- plugins/console/src/node/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/console/src/node/index.ts b/plugins/console/src/node/index.ts index bce29ca2..7353a26d 100644 --- a/plugins/console/src/node/index.ts +++ b/plugins/console/src/node/index.ts @@ -127,7 +127,7 @@ class NodeConsole extends Console { private serveAssets() { const { uiPath } = this.config - this.ctx.server.get(uiPath + '(/.+)*', async (ctx, next) => { + this.ctx.server.get(uiPath + '(.*)', async (ctx, next) => { await next() if (ctx.body || ctx.response.body) return @@ -215,7 +215,7 @@ class NodeConsole extends Console { }, }) - this.ctx.server.all('/vite(/.+)*', (ctx) => new Promise((resolve) => { + this.ctx.server.all('/vite(.*)', (ctx) => new Promise((resolve) => { this.vite.middlewares(ctx.req, ctx.res, resolve) }))