@@ -23,7 +23,7 @@ import type {
2323 SystemVariablesType
2424} from '@fastgpt/global/core/workflow/runtime/type' ;
2525import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/type.d' ;
26- import { getErrText } from '@fastgpt/global/common/error/utils' ;
26+ import { getErrText , UserError } from '@fastgpt/global/common/error/utils' ;
2727import { ChatItemValueTypeEnum } from '@fastgpt/global/core/chat/constants' ;
2828import { filterPublicNodeResponseData } from '@fastgpt/global/core/chat/utils' ;
2929import {
@@ -58,6 +58,7 @@ import type { MCPClient } from '../../app/mcp';
5858import { TeamErrEnum } from '@fastgpt/global/common/error/code/team' ;
5959import { i18nT } from '../../../../web/i18n/utils' ;
6060import { clone } from 'lodash' ;
61+ import { validateFileUrlDomain } from '../../../common/security/fileUrlValidator' ;
6162
6263type Props = Omit <
6364 ChatDispatchProps ,
@@ -88,7 +89,21 @@ export async function dispatchWorkFlow({
8889} : Props & WorkflowUsageProps ) : Promise < DispatchFlowResponse > {
8990 const { res, stream, runningUserInfo, runningAppInfo, lastInteractive, histories, query } = data ;
9091
92+ // Check url valid
93+ const invalidInput = query . some ( ( item ) => {
94+ if ( item . type === ChatItemValueTypeEnum . file && item . file ?. url ) {
95+ if ( ! validateFileUrlDomain ( item . file . url ) ) {
96+ return true ;
97+ }
98+ }
99+ } ) ;
100+ if ( invalidInput ) {
101+ addLog . info ( '[Workflow run] Invalid file url' ) ;
102+ return Promise . reject ( new UserError ( 'Invalid file url' ) ) ;
103+ }
104+ // Check point
91105 await checkTeamAIPoints ( runningUserInfo . teamId ) ;
106+
92107 const [ { timezone, externalProvider } , newUsageId ] = await Promise . all ( [
93108 getUserChatInfo ( runningUserInfo . tmbId ) ,
94109 ( ( ) => {
0 commit comments