n8n/packages/cli/src
Iván Ovejero 1a87f70e84
fix(core): Perform multi-main leader check against key ID (#7964)
## Summary
Current leader check is based on key presence and multi-main instance
type, which can give rise to [this edge
case](https://n8nio.slack.com/archives/C04B1GZ4T0U/p1702025497086379?thread_ts=1701962808.817579&cid=C04B1GZ4T0U)
where leader fails to realize they lost leadership to a former follower.
PR performs the check against the specific key ID instead to prevent
this.

...

#### How to test the change:
1. ...


## Issues fixed
Include links to Github issue or Community forum post or **Linear
ticket**:
> Important in order to close automatically and provide context to
reviewers

...


## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again. A feature is not complete without tests.
  >
> *(internal)* You can use Slack commands to trigger [e2e
tests](https://www.notion.so/n8n/How-to-use-Test-Instances-d65f49dfc51f441ea44367fb6f67eb0a?pvs=4#a39f9e5ba64a48b58a71d81c837e8227)
or [deploy test
instance](https://www.notion.so/n8n/How-to-use-Test-Instances-d65f49dfc51f441ea44367fb6f67eb0a?pvs=4#f6a177d32bde4b57ae2da0b8e454bfce)
or [deploy early access version on
Cloud](https://www.notion.so/n8n/Cloudbot-3dbe779836004972b7057bc989526998?pvs=4#fef2d36ab02247e1a0f65a74f6fb534e).
2023-12-08 13:55:55 +01:00
..
auth refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
collaboration feat(editor): Show avatars for users currently working on the same workflow (#7763) 2023-11-23 10:14:34 +01:00
commands fix(core): Fix expression evaluator filename typo (no-changelog) (#7960) 2023-12-07 17:50:49 +01:00
config refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
controllers feat: Introduce advanced permissions (#7844) 2023-12-08 12:52:25 +01:00
credentials fix: Restrict updating/deleting of shared but not owned credentials (#7950) 2023-12-07 10:35:40 +00:00
databases feat: Replace owner checks with scope checks (no-changelog) (#7846) 2023-11-29 14:48:36 +00:00
decorators refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
environments ci: Introduce no-plain-errors lint rule for BE packages (no-changelog) (#7961) 2023-12-08 12:51:49 +01:00
errors refactor: Unify severity and level for all application errors for Sentry (no-changelog) (#7956) 2023-12-07 16:57:02 +01:00
eventbus feat: Add initial scope checks via decorators (#7737) 2023-11-28 11:41:34 +00:00
executionLifecycleHooks test(core): Isolate restore binary data ID in execution lifecycle hooks (no-changelog) (#7953) 2023-12-07 17:30:47 +01:00
executions feat: Replace owner checks with scope checks (no-changelog) (#7846) 2023-11-29 14:48:36 +00:00
ExternalSecrets refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
helpers fix(core): Add check that queue is defined and remove cyclic dependency (#7404) 2023-10-13 11:53:59 +02:00
Ldap refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
license refactor(core): Reorganize error hierarchy in cli package (no-changelog) (#7839) 2023-11-28 10:19:27 +01:00
Mfa ci(core): Reduce memory usage in tests (part-2) (no-changelog) (#7671) 2023-11-10 15:04:26 +01:00
middlewares refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
permissions fix: Restrict updating/deleting of shared but not owned credentials (#7950) 2023-12-07 10:35:40 +00:00
posthog refactor: Run lintfix (no-changelog) (#7537) 2023-10-27 14:15:02 +02:00
PublicApi feat: Add admin role to public API (no-changelog) (#7933) 2023-12-05 15:00:14 +00:00
push feat(core): Update LLM applications building support (no-changelog) (#7710) 2023-11-28 16:47:28 +01:00
security-audit perf(core): Lazyload security audit reporters (#7696) 2023-11-13 11:50:43 +01:00
services fix(core): Perform multi-main leader check against key ID (#7964) 2023-12-08 13:55:55 +01:00
sso refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
telemetry refactor: Run lintfix (no-changelog) (#7537) 2023-10-27 14:15:02 +02:00
types refactor: Move CLI commands types to own dir (no-changelog) (#6658) 2023-07-13 10:10:08 +02:00
UserManagement refactor: Unify severity and level for all application errors for Sentry (no-changelog) (#7956) 2023-12-07 16:57:02 +01:00
workflows fix(core): Consolidate ownership and sharing data on workflows and credentials (#7920) 2023-12-05 10:11:18 +01:00
AbstractServer.ts refactor(core): Reorganize error hierarchy in cli package (no-changelog) (#7839) 2023-11-28 10:19:27 +01:00
ActivationErrors.service.ts feat(core): Coordinate manual workflow activation and deactivation in multi-main scenario (#7643) 2023-11-17 15:58:50 +01:00
ActiveExecutions.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
ActiveWebhooks.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
ActiveWorkflowRunner.ts feat: Replace owner checks with scope checks (no-changelog) (#7846) 2023-11-29 14:48:36 +00:00
constants.ts feat: Add AI tool building capabilities (#7336) 2023-11-29 12:13:55 +01:00
CrashJournal.ts refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
CredentialsHelper.ts feat: Replace owner checks with scope checks (no-changelog) (#7846) 2023-11-29 14:48:36 +00:00
CredentialsOverwrites.ts refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
CredentialTypes.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
curlconverter.d.ts refactor: Clear unused ESLint directives from BE packages (no-changelog) (#6798) 2023-07-31 11:00:48 +02:00
CurlConverterHelper.ts refactor: Clear unused ESLint directives from BE packages (no-changelog) (#6798) 2023-07-31 11:00:48 +02:00
Db.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
ErrorReporting.ts feat(core): Add package name tag to Sentry errors (no-changelog) (#7958) 2023-12-08 11:30:06 +01:00
ExpressionEvaluator.ts fix(core): Fix expression evaluator filename typo (no-changelog) (#7960) 2023-12-07 17:50:49 +01:00
ExternalHooks.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
GenericHelpers.ts refactor(core): Reorganize error hierarchy in cli package (no-changelog) (#7839) 2023-11-28 10:19:27 +01:00
index.ts ci: Refactor cli tests to speed up CI (no-changelog) (#5718) 2023-03-17 17:24:05 +01:00
Interfaces.ts feat(core): Add Support for custom CORS origins for webhooks (#7455) 2023-11-22 17:49:56 +01:00
InternalHooks.ts fix(core): Prevent executions from becoming forever running (#7569) 2023-11-01 13:51:13 +01:00
jest.d.ts feat(core): Security audit (#5034) 2023-01-05 13:28:40 +01:00
License.ts feat(core): Set up endpoint for all existing roles with license flag (#7834) 2023-11-28 14:16:47 +01:00
LoadNodesAndCredentials.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
Logger.ts ci: Stop disabling linting rules that are explicitly set to warn (no-changelog) (#7669) 2023-11-09 14:05:39 +01:00
NodeTypes.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
Queue.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
requests.ts fix(core): Consolidate ownership and sharing data on workflows and credentials (#7920) 2023-12-05 10:11:18 +01:00
ResponseHelper.ts refactor(core): Reorganize error hierarchy in cli package (no-changelog) (#7839) 2023-11-28 10:19:27 +01:00
SecretsHelpers.ts feat: External Secrets storage for credentials (#6477) 2023-08-25 10:33:46 +02:00
Server.ts feat: Replace owner checks with scope checks (no-changelog) (#7846) 2023-11-29 14:48:36 +00:00
sse-channel.d.ts feat(core): Add support for WebSockets as an alternative to Server-Sent Events (#5443) 2023-02-10 15:02:47 +01:00
TestWebhooks.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
utils.ts fix(core): Set up OAuth2 cred test (#6960) 2023-08-18 16:18:44 +02:00
WaitingWebhooks.ts refactor(core): Reorganize error hierarchy in cli package (no-changelog) (#7839) 2023-11-28 10:19:27 +01:00
WaitTracker.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
WebhookHelpers.ts fix(Webhook Node): Binary data handling (#7804) 2023-12-06 17:46:40 +02:00
WebhookServer.ts feat(core): Add unique id to instances (#6863) 2023-08-07 17:03:21 +02:00
WorkflowCredentials.ts refactor(core): Switch plain errors in cli to ApplicationError (#7857) 2023-11-29 12:25:10 +01:00
WorkflowExecuteAdditionalData.ts test(core): Isolate restore binary data ID in execution lifecycle hooks (no-changelog) (#7953) 2023-12-07 17:30:47 +01:00
WorkflowHelpers.ts fix(core): Fix user comparison in same-user subworkflow caller policy (#7913) 2023-12-06 12:27:11 +00:00
WorkflowRunner.ts fix: Ensure external hooks post workflow execute run in queue mode (#7947) 2023-12-07 10:00:05 +00:00
WorkflowRunnerProcess.ts ci: Stop disabling linting rules that are explicitly set to warn (no-changelog) (#7669) 2023-11-09 14:05:39 +01:00