Skip to content

bugfix:308 | remove ungated overrideConfig spread#6279

Open
jchui-wd wants to merge 1 commit intomainfrom
bugfix/308-Flow-Execution-overrideConfig-spread-in-prediction-API
Open

bugfix:308 | remove ungated overrideConfig spread#6279
jchui-wd wants to merge 1 commit intomainfrom
bugfix/308-Flow-Execution-overrideConfig-spread-in-prediction-API

Conversation

@jchui-wd
Copy link
Copy Markdown
Contributor

@jchui-wd jchui-wd commented Apr 23, 2026

Changes

  • Remove ...overrideConfig spread from flowConfig/flowData objects in buildChatflow.ts, buildAgentflow.ts, and util.index.ts
  • This spread allowed API callers to inject arbitrary keys into the $flow.* template variable namespace without any authorization check, bypassing the per-parameter gating that replaceInputsWithConfig() enforces
  • Internal $flow.* variables (chatId, sessionId, chatHistory, etc.) continue to resolve because they are explicit fields on the config objects

Fixes: Flowise 308

Video Demos

Test Videos Demo

Chatflow-Before-injected.mp4

Chatflow-Before-injected.mp4

Chatflow-After-not-injected.mp4

Chatflow-After-not-injected.mp4

Agentflow-BEFORE-ap...still-can-override.mp4

Agentflow-BEFORE-apiOverride-off-still-can-override.mp4

Agentflow-AFTER-Nee...Override-To-Work.mp4

Agentflow-AFTER-Need-apiOverride-To-Work.mp4

…wData

The spread allowed API callers to inject arbitrary keys into the $flow.*
template namespace — bypassing the per-parameter gating that
replaceInputsWithConfig() enforces. Properly gated override paths
(replaceInputsWithConfig, $vars) are unaffected.

Closes FLOWISE-308
Copy link
Copy Markdown
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 improves security by removing the spread of overrideConfig (mass assignment) in buildAgentflow.ts, buildChatflow.ts, and index.ts. A review comment points out that in packages/server/src/utils/index.ts, the resulting object is now missing apiMessageId and chatflowId, which are necessary for consistent variable resolution across different flow types.

Comment on lines 568 to +571
chatflowid,
chatId,
sessionId,
chatHistory,
...overrideConfig
chatHistory
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While removing the overrideConfig spread is correct for security, this flowData object is now missing apiMessageId and chatflowId (camelCase), which are included in the equivalent objects in buildChatflow.ts and buildAgentflow.ts. Adding them here ensures consistency for $flow.* variable resolution across different flow types and execution phases.

        chatflowid,
        chatflowId: chatflowid,
        chatId,
        sessionId,
        chatHistory,
        apiMessageId,
References
  1. Avoid mass assignment from request bodies to entities. Instead of using a generic assignment like Object.assign(entity, body), explicitly map allowed properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

flowData in index.ts never had chatflowId or apiMessageId, even in the original PR #3075 that introduced it. The ...overrideConfig spread was masking this since it could coincidentally include those keys.
I can add chatflowId and apiMessageId if needed

runtimeChatHistoryLength: Math.max(0, runtimeChatHistory.length - 1),
state: updatedState,
...overrideConfig
state: updatedState
Copy link
Copy Markdown
Contributor Author

@jchui-wd jchui-wd Apr 23, 2026

Choose a reason for hiding this comment

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

although the ticket recommended to just remove the ...overrideConfig.

It is kind of in conflict with this PR #3075

That PR purposely allowed any $flow.* variables to be injected, with this change it won't be allowed anymore.

If we still want that to be allowed we can do something like ...(apiOverrideStatus ? incomingInput.overrideConfig : {})
so when they enable apiOverrideStatus it will still work as it did before.

But I do believe removing ...overrideConfig is more correct and is better to rely on replaceInputsWithConfig()

@jchui-wd jchui-wd marked this pull request as ready for review April 23, 2026 23:00
@jchui-wd jchui-wd changed the title fix(server): remove ungated overrideConfig spread into flowConfig/flo… bugfix:308 | remove ungated overrideConfig spread Apr 23, 2026
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.

2 participants