mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 02:14:33 +00:00
fix(security): prevent gatewayUrl SSRF
This commit is contained in:
@@ -102,8 +102,15 @@ export type MessagePollResult = {
|
||||
};
|
||||
|
||||
function resolveGatewayOptions(opts?: MessageGatewayOptions) {
|
||||
// Security: backend callers (tools/agents) must not accept user-controlled gateway URLs.
|
||||
// Use config-derived gateway target only.
|
||||
const url =
|
||||
opts?.mode === GATEWAY_CLIENT_MODES.BACKEND ||
|
||||
opts?.clientName === GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT
|
||||
? undefined
|
||||
: opts?.url;
|
||||
return {
|
||||
url: opts?.url,
|
||||
url,
|
||||
token: opts?.token,
|
||||
timeoutMs:
|
||||
typeof opts?.timeoutMs === "number" && Number.isFinite(opts.timeoutMs)
|
||||
|
||||
Reference in New Issue
Block a user