Skip to content

Conversation

@guillaumejacquart
Copy link
Contributor

@guillaumejacquart guillaumejacquart commented Jan 6, 2026

Summary

This PR implements new DTOs for workflow creation and update, to make sure that user cannot forge a request containing fields that should be updated only internally (like triggerCount, versionCounter, or shared fields)

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/PAY-4382/mass-assignment-in-workflow-creation-allows-tampering-with-internal

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 89.28571% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...n/api-types/src/dto/workflows/base-workflow.dto.ts 84.00% 4 Missing ⚠️
packages/@n8n/api-types/src/dto/index.ts 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@blacksmith-sh

This comment has been minimized.

@currents-bot
Copy link

currents-bot bot commented Jan 6, 2026

E2E Tests: n8n tests passed after 9m 21.7s

🟢 609 · 🔴 0 · ⚪️ 38 · 🟣 2

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 5edcbdd

  • Spec files: 142

  • Overall tests: 647

  • Duration: 9m 21.7s

  • Parallelization: 16

Groups

GroupId Results Spec Files Progress
multi-main:e2e 🟢 552 · 🔴 0 · ⚪️ 38 · 🟣 1 133 / 133
multi-main:e2e:isolated 🟢 57 · 🔴 0 · ⚪️ 0 · 🟣 1 9 / 9


This message was posted automatically by currents.dev | Integration Settings

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Jan 6, 2026
@guillaumejacquart guillaumejacquart force-pushed the pay-4382-mass-assignment-in-workflow-creation-allows-tampering-with branch 2 times, most recently from bafa852 to 7812c2f Compare January 6, 2026 20:56
@blacksmith-sh

This comment has been minimized.

@guillaumejacquart guillaumejacquart force-pushed the pay-4382-mass-assignment-in-workflow-creation-allows-tampering-with branch from e4f16f2 to 902e434 Compare January 7, 2026 09:37
@guillaumejacquart guillaumejacquart marked this pull request as ready for review January 7, 2026 10:51
@guillaumejacquart guillaumejacquart requested review from geemanjs and konstantintieber and removed request for geemanjs and konstantintieber January 7, 2026 10:51
@guillaumejacquart guillaumejacquart marked this pull request as draft January 7, 2026 10:52
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 7 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/@n8n/api-types/src/dto/workflows/base-workflow.dto.ts">

<violation number="1" location="packages/@n8n/api-types/src/dto/workflows/base-workflow.dto.ts:21">
P2: Validator accepts arrays when it should only accept plain objects. In JavaScript, `typeof [] === 'object'` returns `true`, so arrays will pass this validation despite the message stating 'Connections must be an object'. Add `&& !Array.isArray(val)` to reject arrays.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@guillaumejacquart guillaumejacquart marked this pull request as ready for review January 7, 2026 11:24
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 9 files

throw new BadRequestError('Invalid timeSavedMode');
}

// Security: Object.assign is now safe because the DTO validates and filters all input
Copy link
Contributor

@konstantintieber konstantintieber Jan 7, 2026

Choose a reason for hiding this comment

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

Nit: I think it's good to remind other readers that Object.assign is only safe here because of the Dto schemas. I would consider shorting it to a single line comment like:

Object.assign is safe because the body provided by the user is validated against the UpdateWorkflowDto

in both methods mainly for readibility.

expect(createdWorkflow?.activeVersionId).toBeNull();
});

test('should always create workflow as inactive regardless of active flag', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great job on these unit tests 👍

description: 'billing bypass',
assertionType: 'exact' as const,
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice us of parameterized tests 💅

@guillaumejacquart guillaumejacquart merged commit b68d0ec into master Jan 7, 2026
55 checks passed
@guillaumejacquart guillaumejacquart deleted the pay-4382-mass-assignment-in-workflow-creation-allows-tampering-with branch January 7, 2026 12:50
@n8n-assistant
Copy link
Contributor

n8n-assistant bot commented Jan 12, 2026

Got released with [email protected]

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

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants