Skip to content

Commit

Permalink
fix(core): Restore workflow ID during execution creation (#8031)
Browse files Browse the repository at this point in the history
Restore workflow ID during execution creation removed by [this
PR](https://github.com/n8n-io/n8n/pull/8002/files#diff-c8cbb62ca9ab2ae45e5f565cd8c63fff6475809a6241ea0b90acc575615224af).
The missing workflow ID, and more generally the fact that `workflow.id`
is optional when it should not be, causes `PermissionChecker.check` to
misreport a credential as inaccessible when it should be accessible.

More generally, start reporting ID-less workflows so we can root them
out and prevent this at type level.

https://n8nio.slack.com/archives/C035KBDA917/p1702539465555529
  • Loading branch information
ivov authored and netroy committed Dec 18, 2023
1 parent 5420976 commit 7add8ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
const { data, workflowData, ...rest } = execution;
const { identifiers: inserted } = await this.insert(rest);
const { id: executionId } = inserted[0] as { id: string };
const { connections, nodes, name } = workflowData ?? {};
const { id, connections, nodes, name } = workflowData ?? {};
await this.executionDataRepository.insert({
executionId,
workflowData: { connections, nodes, name },
workflowData: { id, connections, nodes, name },
data: stringify(data),
});
return String(executionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('ExecutionRepository', () => {
const executionDataRepo = Container.get(ExecutionDataRepository);
const executionData = await executionDataRepo.findOneBy({ executionId });
expect(executionData?.workflowData).toEqual({
id: workflow.id,
connections: workflow.connections,
nodes: workflow.nodes,
name: workflow.name,
Expand Down

0 comments on commit 7add8ca

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy