fix(core): Don't allow using credentials that are not part of the same project (#9916)

This commit is contained in:
Danny Martini
2024-07-03 11:42:59 +02:00
committed by GitHub
parent 962f0d7134
commit ab2a548856
2 changed files with 99 additions and 56 deletions

View File

@@ -141,7 +141,10 @@ export class EnterpriseWorkflowService {
throw new NotFoundError('Workflow not found');
}
const allCredentials = await this.credentialsService.getMany(user);
const allCredentials = await this.credentialsService.getCredentialsAUserCanUseInAWorkflow(
user,
{ workflowId },
);
try {
return this.validateWorkflowCredentialUsage(workflow, previousVersion, allCredentials);
@@ -158,7 +161,7 @@ export class EnterpriseWorkflowService {
validateWorkflowCredentialUsage(
newWorkflowVersion: WorkflowEntity,
previousWorkflowVersion: WorkflowEntity,
credentialsUserHasAccessTo: CredentialsEntity[],
credentialsUserHasAccessTo: Array<{ id: string }>,
) {
/**
* We only need to check nodes that use credentials the current user cannot access,