Skip to content

Commit 5ba1178

Browse files
committed
fix: flowise-615
1 parent b98ff81 commit 5ba1178

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

packages/components/nodes/tools/MCP/core.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,5 +617,25 @@ describe('MCP Security Validations', () => {
617617
}).not.toThrow()
618618
})
619619
})
620+
621+
it('should block absolute cwd', () => {
622+
expect(() => {
623+
validateMCPServerConfig({
624+
command: 'node',
625+
args: ['server.js'],
626+
cwd: '/tmp/evil'
627+
})
628+
}).toThrow('cwd parameter is not allowed in MCP server configuration')
629+
})
630+
631+
it('should block relative cwd', () => {
632+
expect(() => {
633+
validateMCPServerConfig({
634+
command: 'node',
635+
args: ['server.js'],
636+
cwd: '../uploads'
637+
})
638+
}).toThrow('cwd parameter is not allowed in MCP server configuration')
639+
})
620640
})
621641
})

packages/components/nodes/tools/MCP/core.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ export const validateMCPServerConfig = (serverParams: any): void => {
386386
throw new Error('Invalid server configuration')
387387
}
388388

389+
if (serverParams.cwd !== undefined) {
390+
throw new Error('cwd parameter is not allowed in MCP server configuration')
391+
}
392+
389393
// Command allowlist - operator-controlled via CUSTOM_MCP_ALLOWED_COMMANDS (empty = none allowed)
390394
const allowedCommands = (process.env.CUSTOM_MCP_ALLOWED_COMMANDS ?? '')
391395
.split(',')

0 commit comments

Comments
 (0)