Skip to content

Fix Mass Assignment in Assistants Endpoints#6128

Open
christopherholland-workday wants to merge 2 commits intomainfrom
flowise-323-assisstant-b
Open

Fix Mass Assignment in Assistants Endpoints#6128
christopherholland-workday wants to merge 2 commits intomainfrom
flowise-323-assisstant-b

Conversation

@christopherholland-workday
Copy link
Copy Markdown
Contributor

Flowise-323 (See comments on Assistants)

Moved from #6052 (The branch got messed up in previous PR)

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 refactors the assistant creation logic by moving the assignment of workspaceId from the controller to the service layer and introducing stripProtectedFields to sanitize the input. The review feedback recommends replacing Object.assign with explicit property mapping to further mitigate mass assignment vulnerabilities and ensure strict control over entity attributes.

Comment on lines +143 to +144
Object.assign(newAssistant, stripProtectedFields(requestBody))
newAssistant.workspaceId = workspaceId
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.

security-medium medium

Avoid mass assignment from request bodies to entities. Instead of using Object.assign, explicitly map allowed properties. This prevents potential IDOR vulnerabilities and ensures sensitive fields like workspaceId are handled correctly from a trusted source (e.g., user session), as per the repository security rules.

Suggested change
Object.assign(newAssistant, stripProtectedFields(requestBody))
newAssistant.workspaceId = workspaceId
newAssistant.details = requestBody.details
newAssistant.credential = requestBody.credential
newAssistant.iconSrc = requestBody.iconSrc
newAssistant.type = requestBody.type
newAssistant.workspaceId = workspaceId
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. Sensitive fields like workspaceId must be set on the server from a trusted source (e.g., user session), not from the client request body, to prevent IDOR vulnerabilities.

@christopherholland-workday christopherholland-workday marked this pull request as ready for review April 2, 2026 18:45
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.

3 participants