@devries-cameron20 / composio Mirror · read-only / commits / 52efb5b83
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 13:30 UTC

fix(core): respect authConfigId in trigger subscriptions (#4298)

## Summary - Apply the existing authConfigId subscription filter to incoming trigger events. - Add a V3 regression test for mismatched auth configurations. - Add a patch changeset for @composio/core. Previously, a subscription filtered by authConfigId still invoked its callback for events belonging to a different auth configuration. ## Verification - Vitest targeted tests: 76 passed - Vitest core suite: 1244 passed, 2 expected failures - TypeScript typecheck and Prettier passed Fixes the missing authConfigId filtering in trigger subscriptions. --------- Co-authored-by: jkomyno <alberto@composio.dev>

CoralGarden52 committed Sep 3, 2026 at 18:15 UTC 52efb5b83368bf65b0d123eccbed338802005f88
3 files changed +30
.changeset/trigger-auth-config-filter.md new
+5
@@ -0,0 +1,5 @@
1 +---
2 +'@composio/core': patch
3 +---
4 +
5 +Fix trigger subscriptions ignoring the `authConfigId` filter.
ts/packages/core/src/models/Triggers.ts
+15
@@ -558,6 +558,21 @@ export class Triggers<TProvider extends BaseComposioProvider<unknown, unknown, u
558 return false;
559 }
560
561 + // Check if authConfigId filter matches.
562 + // Only V3 trigger payloads (and the legacy TriggerData shape) carry an auth config id;
563 + // V1/V2 payloads and non-trigger V3 events normalize it to '', so this filter drops
564 + // those events entirely. This mirrors the Python SDK's `auth_config_id` filter.
565 + if (
566 + filters.authConfigId &&
567 + filters.authConfigId !== data.metadata.connectedAccount.authConfigId
568 + ) {
569 + logger.debug(
570 + 'Trigger does not match authConfigId filter',
571 + JSON.stringify(filters.authConfigId, null, 2)
572 + );
573 + return false;
574 + }
575 +
576 // Check if triggerName filter matches
577 if (
578 filters.triggerSlug?.length &&
ts/packages/core/test/models/triggers.test.ts
+10
@@ -1251,6 +1251,16 @@ describe('Triggers', () => {
1251 expect(logger.debug).toHaveBeenCalledWith('Parsed Pusher payload as V3 format');
1252 });
1253
1254 + it('should not call callback when V3 auth config does not match', async () => {
1255 + await triggers.subscribe(mockCallback, { authConfigId: 'auth-other' });
1256 + const subscribeCall = vi.mocked(mockPusherService.subscribe).mock.calls[0];
1257 + const filterCallback = subscribeCall[0];
1258 +
1259 + filterCallback(mockV3Payload);
1260 +
1261 + expect(mockCallback).not.toHaveBeenCalled();
1262 + });
1263 +
1264 it('should parse V2 Pusher payload', async () => {
1265 await triggers.subscribe(mockCallback);
1266 const subscribeCall = vi.mocked(mockPusherService.subscribe).mock.calls[0];