Skip to content
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

fix(core): Better input validation for the changeRole endpoint #8189

Merged
merged 9 commits into from
Jan 3, 2024

Conversation

netroy
Copy link
Member

@netroy netroy commented Dec 30, 2023

also refactored the code to

  1. stop passing around scope === 'global', since this code can be used only for changing globalRole.
  2. leak less details when input validation fails.

Review / Merge checklist

  • PR title and summary are descriptive
  • Tests included

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Dec 30, 2023
Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

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

🙏🏻

packages/cli/src/controllers/users.controller.ts Outdated Show resolved Hide resolved
packages/cli/src/controllers/users.controller.ts Outdated Show resolved Hide resolved
packages/cli/src/requests.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/api/users.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/stores/users.store.ts Outdated Show resolved Hide resolved
packages/cli/test/integration/users.api.test.ts Outdated Show resolved Hide resolved
netroy added 5 commits January 2, 2024 15:15
also refactored the code to
1. stop passing around `scope === 'global'`, since this code can be used only for changing globalRole.
2. leak less details when input validation fails.
@netroy netroy force-pushed the fix-changeRole-input-validation branch from e7a5646 to 0912e57 Compare January 2, 2024 14:15
@netroy netroy force-pushed the fix-changeRole-input-validation branch from a2f2ddf to a14d5e9 Compare January 2, 2024 15:06
@netroy netroy requested a review from ivov January 2, 2024 15:06
ivov
ivov previously approved these changes Jan 2, 2024
Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this!

Copy link
Contributor

github-actions bot commented Jan 2, 2024

✅ All Cypress E2E specs passed

Copy link

cypress bot commented Jan 2, 2024

1 flaky test on run #3559 ↗︎

0 325 5 0 Flakiness 1

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project: n8n Commit: 302fe7fa81
Status: Passed Duration: 06:59 💡
Started: Jan 3, 2024 8:13 AM Ended: Jan 3, 2024 8:20 AM
Flakiness  cypress/e2e/29-templates.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Templates > should save template id with the workflow Screenshots Video

Review all test suite changes for PR #8189 ↗︎

Copy link
Contributor

github-actions bot commented Jan 3, 2024

✅ All Cypress E2E specs passed

@ivov ivov merged commit cfe9525 into master Jan 3, 2024
19 checks passed
@ivov ivov deleted the fix-changeRole-input-validation branch January 3, 2024 08:33
@github-actions github-actions bot mentioned this pull request Jan 3, 2024
ivov added a commit that referenced this pull request Jan 3, 2024
#
[1.23.0](https://github.com/n8n-io/n8n/compare/[email protected]@1.23.0)
(2024-01-03)


### Bug Fixes

* **Asana Node:** Omit body from GET, HEAD, and DELETE requests
([#8057](#8057))
([15ffd4f](15ffd4f))
* **core:** Better input validation for the changeRole endpoint
([#8189](#8189))
([cfe9525](cfe9525))
* **core:** Fix issue that pinnedData is not used with Test-Webhooks
([#8123](#8123))
([fa8bd8b](fa8bd8b))
* **core:** Handle empty executions table in pruning in migrations
([#8121](#8121))
([ffaa30d](ffaa30d))
* **core:** Remove circular dependency in WorkflowService and
ActiveWorkflowRunner
([#8128](#8128))
([21788d9](21788d9))
* **core:** Use pinned data only for manual mode
([#8164](#8164))
([ea7e76f](ea7e76f))
* **Discord Node:** Remove unnecessary requirement on parameters
([#8060](#8060))
([ef3a577](ef3a577))
* **editor:** Avoid sanitizing output to search node data
([#8126](#8126))
([c83d9f4](c83d9f4))
* **editor:** Enable explicit undo keyboard shortcut across all code
editors ([#8178](#8178))
([cf7f668](cf7f668))
* **editor:** Fix operation change failing in certain conditions
([#8114](#8114))
([711fa2b](711fa2b))
* **editor:** Fix templates view layout
([#8196](#8196))
([d01e42a](d01e42a))
* **editor:** Fix UI urls when hosted behind a path prefix
([#8198](#8198))
([5c078f1](5c078f1))
* **editor:** Prevent browser zoom when scrolling inside sticky edit
mode ([#8116](#8116))
([e928210](e928210))
* **editor:** Prevent canvas undo/redo when NDV is open
([#8118](#8118))
([39e45d8](39e45d8))
* **editor:** Prevent storing pairedItem data inside of pinData
([#8173](#8173))
([405e267](405e267))
* **GitHub Node:** Fix issue that File->Get did not run once per item
([#8190](#8190))
([11cda41](11cda41))
* **Invoice Ninja Node:** Fix issue with custom invoice numbers not
working with v5 ([#8200](#8200))
([3b6ae2d](3b6ae2d))
* **Microsoft Excel 365 Node:** Ensure arg is string during worksheet
table search ([#8154](#8154))
([8e873ca](8e873ca))
* **Notion Node:** Ensure arg is string during page ID extraction
([#8153](#8153))
([e94b8a6](e94b8a6))
* **Redis Trigger Node:** Activating a workflow with a Redis trigger
fails ([#8129](#8129))
([a169b74](a169b74))
* **Schedule Trigger Node:** Use the correct `moment` import
([#8185](#8185))
([17a4e2e](17a4e2e))
* Show public API upgrade CTA when feature is not enabled
([#8109](#8109))
([e9c7fd7](e9c7fd7))


### Features

* **core:** Add closeFunction support to Sub-Nodes
([#7708](#7708))
([bec0fae](bec0fae))
* **core:** Add user.profile.beforeUpdate hook
([#8144](#8144))
([e126ed7](e126ed7))
* **core:** Improvements/overhaul for nodes working with binary data
([#7651](#7651))
([5e16dd4](5e16dd4))
* **core:** Remove discontinued crypto-js
([#8104](#8104))
([01e9a79](01e9a79))
* **core:** Unify application components shutdown
([#8097](#8097))
([3a881be](3a881be))
* **editor:** Add node execution status indicator to output panel
([#8124](#8124))
([ab74bad](ab74bad))
* **editor:** Add template Id to workflow metadata
([#8088](#8088))
([517b050](517b050))
* **Home Assistant Node:** Use the new Home Assistant logo
([#8150](#8150))
([518a99e](518a99e))
* **Qdrant Vector Store Node:** Qdrant vector store support
([#8080](#8080))
([66460f6](66460f6))
* **Wordpress Node:** Add option to ignore error when using self signed
certificates ([#8199](#8199))
([65c8e12](65c8e12))

Co-authored-by: ivov <[email protected]>
@Joffcom
Copy link
Member

Joffcom commented Jan 3, 2024

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 ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants