-
-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Fix: prevent ssrf and Input type confusion issues multiple components #5336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
+115
−8
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@poratoes
poratoes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Harden outbound requests and strengthen input validation across components and server.
- Add HTTP allow-list support (HTTP_ALLOW_LIST) and checkAllowList; enforce for secureFetch initial URL and redirects; only http/https allowed (reduces SSRF risk).
- Make _cleanEmptyS3Folders defensive against unexpected prefix types (handle arrays, ignore non-string/empty prefixes).
- Normalize and sanitize feedbackType query param (accept CSV, JSON array string, or array) in chat-messages controller.
- Validate Azure tenantID format in AzureSSO.testSetup to fail fast on invalid config.
- Validate chatflowId(s) in createEvaluation (parse array or single id, disallow suspicious characters, ensure IDs exist).
Notes:
- Behavior change: secureFetch now requires HTTP_ALLOW_LIST to be configured in environments where allow-list enforcement is desired — set this env var in tests/CI if needed.
- Adds security and robustness fixes; recommend adding unit tests for allow-list/redirects, tenantID validation, feedbackType parsing, S3 prefix handling, and chatflowId validation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description Of Fixes
This request fixes an addresses multiple security vulnerabilities related to Server-Side Request Forgery (SSRF) and unvalidated user input handling across several files within the FlowiseAI codebase. These issues could allow attackers to manipulate outgoing requests, access unintended internal resources, or exploit type confusion to bypass sanitization logic. Each fix introduces proper input validation, allow-list enforcement, and type-safety improvements to ensure robust protection against such threats.
1. Secure Tenant ID Validation in Azure SSO
packages/server/src/enterprise/sso/AzureSSO.tsThetestSetupstatic method previously allowed unvalidated user input (tenantID) to control the hostname in an outgoing HTTP request to Microsoft Azure.This could enable SSRF attacks by redirecting requests to unintended endpoints or internal services.
Fix implemented:
tenantIDbefore constructing the authentication URL..onmicrosoft.com.2. Outbound Request Allow-List for Secure Fetch
packages/components/src/httpSecurity.tsPreviously, user-supplied URLs were used directly in outbound HTTP requests, protected only by a deny-list. This approach left room for bypass attacks or indirect SSRF through redirects.Fix implemented:
secureFetchfunction for both the initial URL and all redirects.HTTP_ALLOW_LIST, defining a comma-separated list of allowed domains or wildcard patterns (e.g.,*.example.com).httpandhttpsonly.3. Validation of Chatflow IDs in Evaluation Service
packages/server/src/services/evaluations/index.tsThe service previously used unvalidatedchatflowIdvalues to construct request URLs, creating a potential SSRF vector if arbitrary IDs were supplied.Fix implemented:
chatflowIdbefore executingEvaluationRunner.runEvaluations.4. Type-Safe Validation for Feedback Parameters
packages/server/src/controllers/chat-messages/index.tsCertain query parameters (feedbackType) were assumed to be strings but could be arrays due to crafted malicious requests. This type confusion could bypass sanitization logic.Fix implemented:
feedbackTypeparameters.ChatMessageRatingTypeenum values are accepted.5. Runtime Type Enforcement for Storage Prefix Parameters
packages/components/src/storageUtils.tsUnvalidatedprefixparameters could cause unsafe string operations or logic errors if arrays or non-string types were passed in.Fix implemented:
prefixis always a valid string before operations likesubstringor concatenation._cleanEmptyS3Foldersfor minimal code impact and maximum safety.These changes collectively harden the application against:
All fixes follow the principle of defense in depth, ensuring that user inputs are validated, sanitized, and restricted at the earliest possible stage.
secureFetchcorrectly blocks disallowed domains.Additional Notes
HTTP_ALLOW_LISTcan be provided via environment variables or config files.