You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(custom_audience): support OAuth linked accounts - #5717
Adds OAuth Client Credentials and Authorization Code linked-account authentication for Custom Audience. Bearer credentials are sourced from each event's metadata.secret.accessToken, and per-event header resolution prevents events with different tokens from sharing a batch.
What is the related Linear task?
Resolves INT-7425
Please explain the objectives of your changes below
Support the two Custom Activation OAuth account definitions while preserving linked-account precedence and explicit no-auth behavior.
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
OAuth-linked Custom Audience events now authenticate with the event metadata access token. Existing non-OAuth linked-account authentication behavior remains unchanged. A missing OAuth token raises the standard platform-classified OAuthSecretError.
Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A
Any technical or performance related pointers to consider with the change?
Headers are resolved per event because OAuth tokens are event-specific. Endpoint caching remains in place. Since headers participate in the batching composite key, events with different tokens are separated automatically, while events with the same token remain batched.
Known limitation
OAuth previews fail closed because preview events do not include metadata.secret.accessToken. They return the missing-token OAuth error instead of using delivery-account or destination-config credentials.
Validation
npm run lint - passed
npm run build:ci - passed
npm test -- --testPathPattern="custom_audience" --no-coverage --runInBand - passed, 188 tests
npm run test:ts -- component --destination=custom_audience - passed, 14 tests
git diff --check - passed
Simplify pass - no behavior-preserving simplifications worth making
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.
👋 I'm rudder-devbox. I opened this PR from a Linear ticket.
Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 9f215c07-8223-4aae-bf39-e558fa202a4f
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The HubSpot live test hs-retl-contacts-update-v1-service-key failed when HubSpot returned 409, “Contact already exists,” during the update scenario. The same commit passed when I reran the failed live (hs) job (attempt 2), confirming a transient live API/search consistency failure. CI is green; no code change was needed.
Both HubSpot merged-record live scenarios failed because the test required job 0 to fail, but CI reported expectedToFailButDelivered: [0]: HubSpot accepted the merged-away contact ID. I updated the test to accept that outcome only when a read-back confirms the surviving contact was updated; omitted-result failures remain required to fail. The focused runner tests (19), HubSpot component tests (86), and TypeScript builds pass. Pushed commit 9d317f616.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Custom Audience previews can fail when the optional send flag is omitted, and events without a linked account can incorrectly enter the OAuth refresh/retry path.
Both arm64 image jobs failed at “Install TruffleHog”: sha256sum reported that the downloaded archive did not match its pinned digest. The digest matches TruffleHog’s published checksum, while the release URL returned HTTP 504 and a 92-byte HTML response, so this was an upstream download failure. I reran the failed jobs on the same commit; the workflow passed on attempt 2. No code change was needed.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The refresh guard intercepts events without a selected linked account or with dynamically disabled authentication, replacing valid transformations or configuration errors with inappropriate retryable refresh responses.
Resolve dynamic authentication config before the refresh guard
src/controllers/destination.ts:119
The refresh guard runs before dynamic configuration is resolved, so a tokenless machine-OAuth event whose authenticationEnabled template resolves to false receives REFRESH_TOKEN instead of transforming without authentication. Partition events after DynamicConfigParser.process, preserving preprocessing error handling and ensuring each event appears only once in the output. Add a regression case for a dynamically disabled authentication toggle.
Test mixed tokenless and token-bearing machine-OAuth events
src/controllers/destination.ts:170
Please add a mixed-request test containing a tokenless machine-OAuth event and one with a valid access token. The new controller tests only intercept a single tokenless event or dispatch events after disabling auth/changing the authentication type; none exercises token-bearing machine OAuth or combining refresh responses with transformed responses. Assert that only the tokenless event requests refresh, the token-bearing event reaches transformation, and each event's metadata appears exactly once in the combined output.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The controller’s token gate bypasses linked-account selection and validation, causing unnecessary 500/REFRESH_TOKEN retries instead of the intended no-auth or permanent configuration-error outcomes.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The OAuth preflight can incorrectly trigger token refreshes because it runs before dynamic authentication settings are resolved and does not verify that a delivery account is selected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the changes introduced in this PR?
Adds OAuth Client Credentials and Authorization Code linked-account authentication for Custom Audience. Bearer credentials are sourced from each event's
metadata.secret.accessToken, and per-event header resolution prevents events with different tokens from sharing a batch.What is the related Linear task?
Resolves INT-7425
Please explain the objectives of your changes below
Support the two Custom Activation OAuth account definitions while preserving linked-account precedence and explicit no-auth behavior.
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
OAuth-linked Custom Audience events now authenticate with the event metadata access token. Existing non-OAuth linked-account authentication behavior remains unchanged. A missing OAuth token raises the standard platform-classified
OAuthSecretError.Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A
Any technical or performance related pointers to consider with the change?
Headers are resolved per event because OAuth tokens are event-specific. Endpoint caching remains in place. Since headers participate in the batching composite key, events with different tokens are separated automatically, while events with the same token remain batched.
Known limitation
OAuth previews fail closed because preview events do not include
metadata.secret.accessToken. They return the missing-token OAuth error instead of using delivery-account or destination-config credentials.Validation
npm run lint- passednpm run build:ci- passednpm test -- --testPathPattern="custom_audience" --no-coverage --runInBand- passed, 188 testsnpm run test:ts -- component --destination=custom_audience- passed, 14 testsgit diff --check- passedDeveloper checklist
Reviewer checklist