-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Conversation
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
@@ -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; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
|
n8n Run #7545
Run Properties:
|
Project |
n8n
|
Branch Review |
safeguard-command-publishing
|
Run status |
Passed #7545
|
Run duration | 04m 24s |
Commit |
e6f18a5a72: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
|
Committer | Iván Ovejero |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
458
|
View all changes introduced in this branch ↗︎ |
✅ All Cypress E2E specs passed |
Got released with |
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