Skip to content

Analytics: cookie_sync and setuid events ignore analytics.global.adapters and account enabled flag #4717

Open

Description

@patmmccann

🤖 This issue was written by an AI agent (Claude Code) on behalf of @patmmccann.

What happens

AnalyticsReporterDelegator.isAllowedAdapter checks analytics.global.adapters and the account's analytics.modules.<name>.enabled (isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig) only for AuctionEvent, AmpEvent, NotificationEvent and VideoEvent. CookieSyncEvent and SetuidEvent fall through to the default branch, which skips that check and passes a null activity infrastructure, so the event is allowed:

  • private <T> boolean isAllowedAdapter(T event, String adapter) {
    final ActivityInfrastructure activityInfrastructure;
    final ActivityInvocationPayload activityInvocationPayload;
    switch (event) {
    case AuctionEvent auctionEvent -> {
    if (isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig(adapter, auctionEvent.getAuctionContext())) {
    return false;
    }
    final AuctionContext auctionContext = auctionEvent.getAuctionContext();
    activityInfrastructure = auctionContext != null ? auctionContext.getActivityInfrastructure() : null;
    activityInvocationPayload = auctionContext != null
    ? BidRequestActivityInvocationPayload.of(
    activityInvocationPayload(adapter),
    auctionContext.getBidRequest())
    : null;
    }
    case AmpEvent ampEvent -> {
    if (isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig(adapter, ampEvent.getAuctionContext())) {
    return false;
    }
    final AuctionContext auctionContext = ampEvent.getAuctionContext();
    activityInfrastructure = auctionContext != null ? auctionContext.getActivityInfrastructure() : null;
    activityInvocationPayload = auctionContext != null
    ? BidRequestActivityInvocationPayload.of(
    activityInvocationPayload(adapter),
    auctionContext.getBidRequest())
    : null;
    }
    case NotificationEvent notificationEvent -> {
    if (isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig(adapter, notificationEvent.getAccount())) {
    return false;
    }
    activityInfrastructure = notificationEvent.getActivityInfrastructure();
    activityInvocationPayload = activityInvocationPayload(adapter);
    }
    case VideoEvent videoEvent -> {
    if (isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig(adapter, videoEvent.getAuctionContext())) {
    return false;
    }
    activityInfrastructure = null;
    activityInvocationPayload = null;
    }
    case null, default -> {
    activityInfrastructure = null;
    activityInvocationPayload = null;
    }
    }
    return isAllowedActivity(activityInfrastructure, Activity.REPORT_ANALYTICS, activityInvocationPayload);
    }
    (default branch at L218-L221)
  • private boolean isNotAllowedAdapterByGlobalOrAccountAnalyticsConfig(String adapter, Account account) {
    final Map<String, ObjectNode> modules = Optional.ofNullable(account)
    .map(Account::getAnalytics)
    .map(AccountAnalyticsConfig::getModules)
    .orElse(null);
    if (modules != null && modules.containsKey(adapter)) {
    final ObjectNode moduleConfig = modules.get(adapter);
    if (moduleConfig == null || !moduleConfig.has("enabled")) {
    return false;
    }
    return !moduleConfig.get("enabled").asBoolean();
    }
    return !globalEnabledAdapters.contains(adapter);
    }

As a result, every reporter bean that has been created gets cookie sync and setuid events. That includes reporters that are left out of analytics.global.adapters and reporters an account has turned off with "enabled": false. The only filter is the host-level TCF Purpose 7 check in processEvent(event, tcfContext).

The account is available in both handlers (SetuidContext.account, CookieSyncContext.account), but it isn't put on the events:

Why it matters

Functional and privacy. analytics.global.adapters and the account enabled flag are how hosts and publishers decide which reporters get data. If a publisher has turned a reporter off, that reporter could still get their users' cookie sync and setuid traffic, including the bidder UID on setuid (see #4718).

To reproduce

  1. Enable a reporter, e.g. pubstack.enabled: true, but leave it out of analytics.global.adapters. Or keep it in the list and set account acc1 to {"analytics": {"modules": {"pubstack": {"enabled": false}}}}.
  2. Call /cookie_sync with "account": "acc1", or /setuid?bidder=...&uid=...&account=acc1.
  3. The reporter's processEvent receives a CookieSyncEvent/SetuidEvent. A /openrtb2/auction request for the same account doesn't reach it.

Expected behaviour

Cookie sync and setuid events respect analytics.global.adapters, and the account-level enabled flag when an account is known, in the same way as the other event types.

Suggested fix

Add the Account (and ActivityInfrastructure, see #4718) to CookieSyncEvent and SetuidEvent, and add matching branches to isAllowedAdapter. At minimum, apply the globalEnabledAdapters check in the default branch.

References

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions