Repository navigation
fix: honor OpenAI Ads device-mode hash config - #3295
Conversation
|
👋 I'm rudder-devbox. I opened this PR from a Linear ticket. Mention |
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
🔵 Needs a closer look
Static review found no blocking defects, but privacy-sensitive identifier changes still need regression-test execution with the required toolchain.
No open issues 🎉
What changed in this PR
This PR makes the OpenAI Ads device-mode integration honor isHashRequired while keeping hashing enabled by default.
Changes:
- Applies the hashing configuration to restored-user initialization and identify calls.
- Accepts only SHA-256-shaped customer identifiers when hashing is disabled, lowercases accepted hashes, and preserves anonymous-ID fallback handling.
- Adds regression coverage and documents the hashing behavior.
| File | Description |
|---|---|
packages/analytics-js-integrations/src/integrations/OpenAIAds/utils.js |
Implements configurable hashing and anonymous-ID handling. |
packages/analytics-js-integrations/src/integrations/OpenAIAds/constants.js |
Adds a rejection message for unhashed identifiers. |
packages/analytics-js-integrations/src/integrations/OpenAIAds/browser.js |
Passes hashing configuration into user-data processing. |
packages/analytics-js-integrations/__tests__/integrations/OpenAIAds/browser.test.js |
Covers hashing modes, identifier validation, and restored users. |
.agents/knowledge/patterns.md |
Documents the identifier hashing rules. |
Review effort: Balanced
size-limit report 📦
|
|
The Security checks job failed because I updated the production lockfile resolution to |
|
Recorded knowledge from this round:
|
|
@rudder-devbox please address the following review feedback on this PR:
|
|
Resolved |
|
Recorded knowledge from this round:
|
|
## What are the changes introduced in this PR? OpenAI Ads cloud transformations now honor destination-level `isHashRequired`. Hashing remains enabled when the setting is absent, while disabling it accepts valid pre-hashed customer identifiers and lowercases them before delivery. When hashing is disabled and `userId` is absent, the SDK-generated `anonymousId` fallback is handled separately: an existing SHA-256 digest passes through lowercased, while a plain value is normalized and hashed through the existing external-ID path. Audience hashing consistency metrics also carry the real workspace and destination identifiers. The transformer passes only plain destination metadata through the OpenAI Ads builder. The descriptor required by `processAudienceRecord` is constructed at the utility call boundary, and hash-format recognition is shared with audience consistency validation. Focused unit and component coverage verifies enabled, disabled, and default behavior, all supported hashed identifiers, anonymous-ID fallback handling, mixed/plain input rejection, metric attribution, and the shared hash-format predicate. ## What is the related Linear task? Resolves INT-7432 ## Please explain the objectives of your changes below Allow customers that hash OpenAI Ads identifiers upstream to disable transformer hashing without changing the existing default behavior. The matching destination configuration is provided by [rudder-integrations-config#2864](rudderlabs/rudder-integrations-config#2864). ### Any changes to existing capabilities/behaviour, mention the reason & what are the changes ? When `isHashRequired` is `false`, email, phone number, first name, last name, and `userId` must already be normalized and SHA-256 hashed; plain values remain rejected. Pre-hashed values are emitted as lowercase hexadecimal strings. If `userId` is absent, RudderStack automatically normalizes and hashes a plain `anonymousId` fallback, or lowercases and passes through an already-hashed fallback. An absent or `true` setting retains the existing normalization and hashing behavior. ### Any new dependencies introduced with this change? N/A ### Any new generic utility introduced or modified. Please explain the changes. Exposes `isAlreadyHashed(value, hashingType)` from the shared audience utility and uses it in both hashing-consistency validation and the OpenAI Ads anonymous-ID fallback decision. The shared digest regex remains the single definition of an already-hashed value. ### Any technical or performance related pointers to consider with the change? OpenAI Ads passes `workspaceId` and `destinationId` as plain metadata through its builder. `processHashedUserPayload` constructs the destination descriptor only where `processAudienceRecord` is called, preserving the uppercase `OPENAI_ADS` metric series without leaking the audience utility input shape through the transformer. ## Validation - `npm run lint` - passed - `npm test -- --testPathPattern="src/v0/(destinations/openai_ads/routerTransform|util/audienceUtils).test.ts" --no-coverage --runInBand` - passed, 120 tests - `npm run test:ts -- component --destination=openai_ads` - passed, 14 tests - `./node_modules/.bin/tsc --noEmit -p tsconfig.test.json` - passed - Full secret-path regeneration passed; OpenAI Ads still derives only `headers.Authorization`, and the aggregate artifact remains unchanged - `git diff --check` - passed - Simplification pass reused the existing plaintext and SHA-256 fixtures across the new helper cases and consistency tests ##⚠️ Known Issues - End-to-end runtime verification was skipped because the local stack uses a SHA-pinned transformer image and cannot source-exercise this change. - Web device-mode support for `isHashRequired` will follow in [rudder-sdk-js#3295](rudderlabs/rudder-sdk-js#3295). - Release remains dependent on the matching integrations-config rollout and required `rudder-hugo` documentation covering pre-hashed customer identifiers, automatic anonymous-ID fallback hashing, normalization responsibilities, and both cloud and web device-mode behavior. <hr> ### Developer checklist - [x] My code follows the style guidelines of this project - [x] **No breaking changes are being introduced.** - [ ] All related docs linked with the PR? - [ ] All changes manually tested? - [x] Any documentation changes needed with this change? Required `rudder-hugo` dependency described above. - [x] Is the PR limited to 10 file changes? - [x] Is the PR limited to one linear task? - [x] 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. --------- Co-authored-by: tech-infra-rudderstack <[email protected]>



PR Description
Honor
isHashRequiredin the OpenAI Ads Measurement Pixel integration while keeping hashing enabled by default. When hashing is disabled, only SHA-256-looking customer identifiers are accepted and forwarded lowercase; plaintext identifiers are logged and dropped. Anonymous ID fallbacks continue to be hashed when non-hex and passed through lowercase when already hashed.Coverage includes restored-user seeding, identify calls, default and explicit modes, uppercase hashes, plaintext rejection, anonymous ID behavior, real user ID gating, absent identifiers, and unchanged location fields.
Linear task (optional)
INT-7435
Cross Browser Tests
Sanity Suite
Security
The strict SHA-256 gate remains active in hashing-disabled mode, preventing plaintext PII from being sent to the third-party pixel.
Security dependency refresh
The
package-lock.jsonupdate raisesfollow-redirectsfrom 1.16.0 to 1.16.1 because GHSA-q3jh-wrc6-jgq8 and GHSA-8r9p-f939-6h3c (high severity, published 2026-10-20) affect versions>= 1.16.0, < 1.16.1. Without this refresh,npm audit --audit-level=high --omit=devfails theSecurity checksjob for every PR based ondevelop.This is a lockfile-only patch update within
[email protected]'s existing^1.16.0range;package.jsonis unchanged. The nested Nx copy remains at 1.15.11, is dev-only, and is outside the affected range.Dependabot group PR #3290 also carries this refresh, so whichever PR merges second will need its lockfile regenerated against the updated base.
Validation
git diff --check: passed locally.Unit Tests and Lint: passed.Bundle size checks: passed.Security checks: passed.