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): Add safeguard for command publishing #11337

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Oct 22, 2024

Until we decouple command publishing from all the various services, e.g. via a relay, we should ensure that main mode is unable to publish commands.

Context: https://n8nio.slack.com/archives/C069HS026UF/p1729526419136009

Until we decouple command publishing from all the various services,
e.g. via a relay, we should ensure that main mode is unable to publish
commands.

Context: https://n8nio.slack.com/archives/C069HS026UF/p1729526419136009
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Oct 22, 2024
@@ -46,6 +46,9 @@ export class Publisher {

/** Publish a command into the `n8n.commands` channel. */
async publishCommand(msg: Omit<PubSub.Command, 'senderId'>) {
// @TODO: Once this class is only ever used in scaling mode, remove next line.
if (config.getEnv('executions.mode') !== 'queue') return;
Copy link
Member

Choose a reason for hiding this comment

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

it feels like we are repeating this check. Since the execution mode can't change at runtime, could we not change await this.client.publish to await this.client?.publish instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a fan of either execution mode sanity checks or calling methods with an uninitialized client. This is only a temporary fix until we can decouple and dynamically load the Publisher as mentioned here.

Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link

cypress bot commented Oct 23, 2024

n8n    Run #7545

Run Properties:  status check passed Passed #7545  •  git commit e6f18a5a72: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
Project n8n
Branch Review safeguard-command-publishing
Run status status check passed Passed #7545
Run duration 04m 24s
Commit git commit e6f18a5a72: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
Committer Iván Ovejero
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 458
View all changes introduced in this branch ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@ivov ivov merged commit 656439e into master Oct 24, 2024
33 checks passed
@ivov ivov deleted the safeguard-command-publishing branch October 24, 2024 11:22
This was referenced Oct 28, 2024
@janober
Copy link
Member

janober commented Oct 31, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants