path traversal check on chatId
This commit is contained in:
parent
ec1762b10f
commit
f4281457df
|
|
@ -27,15 +27,15 @@ export const createFileAttachment = async (req: Request) => {
|
|||
const appServer = getRunningExpressApp()
|
||||
|
||||
const chatflowid = req.params.chatflowId
|
||||
const chatId = req.params.chatId
|
||||
|
||||
if (!chatflowid || !isValidUUID(chatflowid)) {
|
||||
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'Invalid chatflowId format - must be a valid UUID')
|
||||
}
|
||||
if (isPathTraversal(chatflowid)) {
|
||||
if (isPathTraversal(chatflowid) || isPathTraversal(chatId)) {
|
||||
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'Invalid path characters detected')
|
||||
}
|
||||
|
||||
const chatId = req.params.chatId
|
||||
|
||||
// Validate chatflow exists and check API key
|
||||
const chatflow = await appServer.AppDataSource.getRepository(ChatFlow).findOneBy({
|
||||
id: chatflowid
|
||||
|
|
|
|||
Loading…
Reference in New Issue