Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,35 @@ describe('CredentialsPermissionChecker', () => {
);
});

it('should check generic auth credential type selected by genericAuthType', async () => {
const genericCredentialNode: INode = {
...httpRequestNode,
parameters: {
authentication: 'genericCredentialType',
genericAuthType: 'httpBearerAuth',
},
};

nodeTypes.getByNameAndVersion.mockReturnValue({
description: {
credentials: [],
},
} as never);

sharedCredentialsRepository.getFilteredAccessibleCredentials.mockResolvedValue([
staleCredentialId,
]);
credentialsRepository.find.mockResolvedValue([]);

await expect(
permissionChecker.check(workflowId, [genericCredentialNode]),
).resolves.not.toThrow();

expect(sharedCredentialsRepository.getFilteredAccessibleCredentials).toHaveBeenCalledWith(
[teamProject.id],
[staleCredentialId],
);
});
it('should fall back to checking all credentials if node type cannot be resolved', async () => {
nodeTypes.getByNameAndVersion.mockImplementation(() => {
throw new Error('Unknown node type');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,17 @@ export class CredentialsPermissionChecker {

// For nodes using predefined credential type (e.g., HTTP Request node),
// the active credential is specified by the nodeCredentialType parameter
const { nodeCredentialType } = node.parameters;
const { nodeCredentialType, genericAuthType } = node.parameters;
if (typeof nodeCredentialType === 'string' && nodeCredentialType) {
activeTypes.add(nodeCredentialType);
}

// For nodes using generic credential mode (e.g., HTTP Request node),
// the active credential is specified by the genericAuthType parameter
if (typeof genericAuthType === 'string' && genericAuthType) {
activeTypes.add(genericAuthType);
}

return activeTypes;
} catch {
// If we can't resolve the node type, fall back to checking all credentials
Expand Down