Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
bc7eae2e
authored
Mar 25, 2026
by
Archer
Committed by
GitHub
Mar 25, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mcp ssrf check (#6640)
parent
b15d7d78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
projects/app/src/pages/api/core/app/httpTools/runTool.ts
+3
-0
projects/app/src/pages/api/core/app/mcpTools/getTools.ts
+5
-0
projects/app/src/pages/api/core/app/mcpTools/runTool.ts
+5
-0
No files found.
projects/app/src/pages/api/core/app/httpTools/runTool.ts
View file @
bc7eae2e
...
...
@@ -4,6 +4,7 @@ import { type StoreSecretValueType } from '@fastgpt/global/common/secret/type';
import
type
{
RunHTTPToolResult
}
from
'@fastgpt/service/core/app/http'
;
import
{
runHTTPTool
}
from
'@fastgpt/service/core/app/http'
;
import
type
{
HttpToolConfigType
}
from
'@fastgpt/global/core/app/tool/httpTool/type'
;
import
{
authCert
}
from
'@fastgpt/service/support/permission/auth/common'
;
export
type
RunHTTPToolQuery
=
{};
...
...
@@ -25,6 +26,8 @@ async function handler(
req
:
ApiRequestProps
<
RunHTTPToolBody
,
RunHTTPToolQuery
>
,
res
:
ApiResponseType
<
RunHTTPToolResponse
>
):
Promise
<
RunHTTPToolResponse
>
{
await
authCert
({
req
,
authToken
:
true
});
const
{
params
,
baseUrl
,
...
...
projects/app/src/pages/api/core/app/mcpTools/getTools.ts
View file @
bc7eae2e
...
...
@@ -8,6 +8,7 @@ import {
type
GetMcpToolsBodyType
,
type
GetMcpToolsResponseType
}
from
'@fastgpt/global/openapi/core/app/mcpTools/api'
;
import
{
isInternalAddress
,
PRIVATE_URL_TEXT
}
from
'@fastgpt/service/common/system/utils'
;
async
function
handler
(
req
:
ApiRequestProps
<
GetMcpToolsBodyType
>
,
...
...
@@ -15,6 +16,10 @@ async function handler(
):
Promise
<
GetMcpToolsResponseType
>
{
const
{
url
,
headerSecret
}
=
GetMcpToolsBodySchema
.
parse
(
req
.
body
);
if
(
await
isInternalAddress
(
url
))
{
return
Promise
.
reject
(
PRIVATE_URL_TEXT
);
}
const
mcpClient
=
new
MCPClient
({
url
,
headers
:
getSecretValue
({
...
...
projects/app/src/pages/api/core/app/mcpTools/runTool.ts
View file @
bc7eae2e
...
...
@@ -7,6 +7,7 @@ import {
type
RunMcpToolBodyType
,
type
RunMcpToolResponseType
}
from
'@fastgpt/global/openapi/core/app/mcpTools/api'
;
import
{
isInternalAddress
,
PRIVATE_URL_TEXT
}
from
'@fastgpt/service/common/system/utils'
;
async
function
handler
(
req
:
ApiRequestProps
<
RunMcpToolBodyType
>
,
...
...
@@ -14,6 +15,10 @@ async function handler(
):
Promise
<
RunMcpToolResponseType
>
{
const
{
url
,
toolName
,
headerSecret
,
params
}
=
RunMcpToolBodySchema
.
parse
(
req
.
body
);
if
(
await
isInternalAddress
(
url
))
{
return
Promise
.
reject
(
PRIVATE_URL_TEXT
);
}
const
mcpClient
=
new
MCPClient
({
url
,
headers
:
getSecretValue
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment