Skip to content

Use secureFetch and secureAxiosRequest for more URLs#5886

Open
christopherholland-workday wants to merge 3 commits intomainfrom
secure-http
Open

Use secureFetch and secureAxiosRequest for more URLs#5886
christopherholland-workday wants to merge 3 commits intomainfrom
secure-http

Conversation

@christopherholland-workday
Copy link
Contributor

FLOWISE-285

@christopherholland-workday christopherholland-workday changed the title Use secureFetch and secureAxiosRequest for URL's controlled by user i… Use secureFetch and secureAxiosRequest for more URLs Mar 3, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to significantly improve security by consistently replacing axios and fetch calls with secureAxiosRequest and secureFetch wrappers, and by implementing support for custom CA certificates via agentOptions. While this is a positive step, the current implementation of these secure helpers is flawed: they fail to drop sensitive headers (like Authorization) during cross-origin redirects, potentially leading to credential leakage. Additionally, the MCP toolkit's validation pattern is insufficient, making it vulnerable to DNS rebinding and redirect-based SSRF. These critical security vulnerabilities must be addressed to ensure the intended security benefits are fully realized. A minor issue also noted is a leftover debugging statement that needs removal.

Comment on lines 203 to 207
while (redirectCount <= maxRedirects) {
const resolved = await resolveAndValidate(currentUrl)
const agent = createPinnedAgent(resolved)
const agent = createPinnedAgent(resolved, agentOptions)

const response = await fetch(currentUrl, { ...currentInit, agent: () => agent })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

The secureFetch function implements manual redirect handling but fails to remove sensitive headers like Authorization or Cookie when following a redirect to a different origin. This can lead to credential leakage if a trusted server redirects the request to a malicious third-party domain.

Remediation: Check if the redirect URL has a different origin than the current URL and, if so, strip sensitive headers from the request configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be better for another PR as it's not directly related to this change

@FlowiseAI FlowiseAI deleted a comment from gemini-code-assist bot Mar 3, 2026
@christopherholland-workday christopherholland-workday marked this pull request as ready for review March 3, 2026 23:40
@HenryHengZJ
Copy link
Contributor

For secureAxios and secureFetch, do we by default block local access? As this involved changing the widely used ExecuteFlow and MCP tools, so need to be extra careful we dont break OSS users

@christopherholland-workday
Copy link
Contributor Author

For secureAxios and secureFetch, do we by default block local access? As this involved changing the widely used ExecuteFlow and MCP tools, so need to be extra careful we dont break OSS users

@HenryHengZJ Blocking local by default is the security approach we decided to take in other changes, e.g. #5862

Users can control what's blocked (and control the default) using the env vars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants