fix: validate credential ownership in attribute sync update (#28873)

This commit is contained in:
Pedro Castro authored and GitHub committed 2026-04-14 08:29:26 -03:00
1 parent 51e852f671
commit cbb234cb35
3 files changed
+35 -2

No files matched your search

@@ -63,6 +63,7 @@ export interface ISyncFormData {
id: string;
name: string;
credentialId?: number;
integration?: AttributeSyncIntegrations;
enabled: boolean;
organizationId: number;
ruleId: string;
@@ -138,7 +139,7 @@ export interface IIntegrationAttributeSyncUpdateParams {
integrationAttributeSync: Omit<
IntegrationAttributeSync,
"attributeSyncRule" | "syncFieldMappings" | "integration"
>;
> & { integration?: AttributeSyncIntegrations };
attributeSyncRule: AttributeSyncRule;
fieldMappingsToCreate: Omit<AttributeSyncFieldMapping, "id">[];
fieldMappingsToUpdate: AttributeSyncFieldMapping[];
@@ -217,4 +217,11 @@ export class IntegrationAttributeSyncService {
async getAllByCredentialId(credentialId: number) {
return this.deps.integrationAttributeSyncRepository.getAllByCredentialId(credentialId);
}
async validateCredentialBelongsToOrg(credentialId: number, organizationId: number) {
return this.deps.credentialRepository.findByIdAndTeamId({
id: credentialId,
teamId: organizationId,
});
}
}