Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
188fd03
Add design spec for Sourcepoint GPP consent support (#640)
ChristianPavilonis Apr 15, 2026
b049897
Add implementation plan for Sourcepoint GPP consent support (#640)
ChristianPavilonis Apr 15, 2026
869e8cd
Add us_sale_opt_out field to GppConsent
ChristianPavilonis Apr 15, 2026
cb9e2b5
Decode US sale opt-out from GPP sections
ChristianPavilonis Apr 15, 2026
d226377
Recognize GPP US sale opt-out in EC consent gating
ChristianPavilonis Apr 15, 2026
5ba2bc5
Add Sourcepoint JS integration for GPP consent cookie mirroring
ChristianPavilonis Apr 15, 2026
945f39a
Add design spec for Prebid User ID Module support
ChristianPavilonis Apr 16, 2026
f71e55f
Add implementation plan for Prebid User ID Module support
ChristianPavilonis Apr 16, 2026
d19e888
Fix ESM path resolution in Prebid User ID plan regression guard
ChristianPavilonis Apr 16, 2026
7660ce8
Add Vitest coverage for Prebid ts-eids cookie sync
ChristianPavilonis Apr 16, 2026
fe2d065
Bundle Prebid User ID core and submodules in Prebid integration
ChristianPavilonis Apr 16, 2026
25194f0
Correct Prebid User ID plan + spec — drop pubCommonIdSystem (removed …
ChristianPavilonis Apr 16, 2026
6f5644e
Drop liveIntentIdSystem from Prebid bundle
ChristianPavilonis Apr 16, 2026
3cae39c
Make Prebid User ID submodule set configurable at build time
ChristianPavilonis Apr 16, 2026
b8dbf2e
Clear stale consent cookies and aggregate US GPP opt-outs
ChristianPavilonis Apr 16, 2026
00cc54b
Add Secure flag and Max-Age to Sourcepoint GPP cookies
ChristianPavilonis Apr 16, 2026
275e892
support ec partners map for env overrides
ChristianPavilonis Apr 17, 2026
be9a930
Scope Sourcepoint consent PR and address review feedback
ChristianPavilonis Apr 21, 2026
4980e77
Remove generated Prebid user ID shim
ChristianPavilonis May 1, 2026
2b4a610
Address Sourcepoint consent review feedback
ChristianPavilonis May 5, 2026
d0dd47b
Address Sourcepoint review feedback
ChristianPavilonis May 6, 2026
86b9453
Isolate EC lifecycle integration seeds
ChristianPavilonis May 7, 2026
3d5f2a2
Promote EC lifecycle logs to info
ChristianPavilonis May 8, 2026
6dee8ed
why
ChristianPavilonis May 8, 2026
35bca7e
Support Sourcepoint usnat consent storage
ChristianPavilonis May 8, 2026
985a7b5
Add build-time Prebid User ID module generation
ChristianPavilonis May 8, 2026
9c32370
Skip Prebid User ID modules that require require
ChristianPavilonis May 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-integration-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ runs:
env:
TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:${{ inputs.origin-port }}
TRUSTED_SERVER__PUBLISHER__PROXY_SECRET: integration-test-proxy-secret
TRUSTED_SERVER__EC__PASSPHRASE: integration-test-ec-secret
TRUSTED_SERVER__EC__PASSPHRASE: integration-test-ec-secret-padded-32
TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false"
run: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
env:
TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:8080
TRUSTED_SERVER__PUBLISHER__PROXY_SECRET: integration-test-proxy-secret
TRUSTED_SERVER__EC__PASSPHRASE: integration-test-ec-secret
TRUSTED_SERVER__EC__PASSPHRASE: integration-test-ec-secret-padded-32
TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false"
run: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1

Expand Down
20 changes: 19 additions & 1 deletion crates/integration-tests/fixtures/configs/viceroy-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,29 @@
key = "placeholder"
data = "placeholder"

# Pre-seeded EC row for KV-backed EC lifecycle tests.
# Pre-seeded EC rows for KV-backed EC lifecycle tests. Each scenario
# uses a separate row so withdrawal tombstones do not leak across
# sequential scenario execution in the same Viceroy instance.
[[local_server.kv_stores.ec_identity_store]]
key = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.test01"
data = '{"v":1,"created":1700000000,"consent":{"ok":true,"updated":1700000000},"geo":{"country":"US","region":"CA"}}'

[[local_server.kv_stores.ec_identity_store]]
key = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.test02"
data = '{"v":1,"created":1700000000,"consent":{"ok":true,"updated":1700000000},"geo":{"country":"US","region":"CA"}}'

[[local_server.kv_stores.ec_identity_store]]
key = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.test03"
data = '{"v":1,"created":1700000000,"consent":{"ok":true,"updated":1700000000},"geo":{"country":"US","region":"CA"}}'

[[local_server.kv_stores.ec_identity_store]]
key = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.test04"
data = '{"v":1,"created":1700000000,"consent":{"ok":true,"updated":1700000000},"geo":{"country":"US","region":"CA"}}'

[[local_server.kv_stores.ec_identity_store]]
key = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.test05"
data = '{"v":1,"created":1700000000,"consent":{"ok":true,"updated":1700000000},"geo":{"country":"US","region":"CA"}}'

[[local_server.kv_stores.ec_partner_store]]
key = "placeholder"
data = "placeholder"
Expand Down
28 changes: 17 additions & 11 deletions crates/integration-tests/tests/frameworks/scenarios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,16 +500,17 @@ impl EcScenario {
/// US Privacy signal that explicitly allows storage in the default Viceroy
/// integration-test geo (US-CA).
const ALLOW_US_PRIVACY_COOKIE: &str = "1YNN";
const SEEDED_EC_ID: &str =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.test01";

fn allow_ec_generation(client: &EcTestClient) {
client.set_cookie("us_privacy", ALLOW_US_PRIVACY_COOKIE);
}

fn use_seeded_ec(client: &EcTestClient) -> String {
client.set_cookie("ts-ec", SEEDED_EC_ID);
normalize_ec_id(SEEDED_EC_ID)
fn seeded_ec_id(hex_digit: char, suffix: &str) -> String {
format!("{}.{suffix}", hex_digit.to_string().repeat(64))
}

fn use_seeded_ec(client: &EcTestClient, ec_id: &str) -> String {
client.set_cookie("ts-ec", ec_id);
normalize_ec_id(ec_id)
}

/// Full lifecycle: seeded EC → batch sync → identify (Bearer auth) with scoped UID.
Expand All @@ -518,7 +519,8 @@ fn use_seeded_ec(client: &EcTestClient) -> String {
fn ec_full_lifecycle(base_url: &str) -> TestResult<()> {
let client = EcTestClient::new(base_url);
allow_ec_generation(&client);
let ec_id = use_seeded_ec(&client);
let seeded_ec_id = seeded_ec_id('a', "test01");
let ec_id = use_seeded_ec(&client, &seeded_ec_id);
log::info!("EC full lifecycle: using seeded EC ID = {ec_id}");

// 2. Batch sync writes partner UID (partner "inttest" is in config)
Expand Down Expand Up @@ -576,7 +578,8 @@ fn ec_full_lifecycle(base_url: &str) -> TestResult<()> {
fn ec_consent_withdrawal(base_url: &str) -> TestResult<()> {
let client = EcTestClient::new(base_url);
allow_ec_generation(&client);
let ec_id = use_seeded_ec(&client);
let seeded_ec_id = seeded_ec_id('b', "test02");
let ec_id = use_seeded_ec(&client, &seeded_ec_id);
log::info!("EC consent withdrawal: using seeded EC = {ec_id}");

// GPC overrides the allow cookie in US-CA, so this is an explicit
Expand Down Expand Up @@ -623,7 +626,8 @@ fn ec_identify_without_ec(base_url: &str) -> TestResult<()> {
fn ec_identify_consent_denied(base_url: &str) -> TestResult<()> {
let client = EcTestClient::new(base_url);
allow_ec_generation(&client);
let _ec_id = use_seeded_ec(&client);
let seeded_ec_id = seeded_ec_id('c', "test03");
let _ec_id = use_seeded_ec(&client, &seeded_ec_id);

// Identify with GPC=1 — in the default US-CA test geo, GPC is an explicit
// denial that must override the allow cookie. Per spec §11.4, consent is
Expand All @@ -647,7 +651,8 @@ fn ec_identify_consent_denied(base_url: &str) -> TestResult<()> {
fn ec_concurrent_partner_syncs(base_url: &str) -> TestResult<()> {
let client = EcTestClient::new(base_url);
allow_ec_generation(&client);
let ec_id = use_seeded_ec(&client);
let seeded_ec_id = seeded_ec_id('d', "test04");
let ec_id = use_seeded_ec(&client, &seeded_ec_id);
log::info!("EC concurrent syncs: using seeded EC = {ec_id}");

// Batch sync both partners (both are pre-configured in trusted-server.toml)
Expand Down Expand Up @@ -705,7 +710,8 @@ fn ec_concurrent_partner_syncs(base_url: &str) -> TestResult<()> {
fn ec_batch_sync_happy_path(base_url: &str) -> TestResult<()> {
let client = EcTestClient::new(base_url);
allow_ec_generation(&client);
let ec_id = use_seeded_ec(&client);
let seeded_ec_id = seeded_ec_id('e', "test05");
let ec_id = use_seeded_ec(&client, &seeded_ec_id);
log::info!("EC batch sync happy path: using seeded ec_id = {ec_id}");

// Batch sync writes a UID for this EC ID (partner "inttest" is in config)
Expand Down
145 changes: 145 additions & 0 deletions crates/js/lib/build-all.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
* names to include in the bundle (e.g. "rubicon,appnexus,openx").
* Each name must have a corresponding {name}BidAdapter.js module in
* the prebid.js package. Default: "rubicon".
*
* TSJS_PREBID_USER_ID_MODULES — Comma-separated list of Prebid.js User ID
* submodules to include (e.g. "connectId,criteo,uid2").
* Modules must exist in prebid.js/modules with a matching JS/TS file.
*/

import fs from 'node:fs';
Expand All @@ -35,6 +39,40 @@ const ADAPTERS_FILE = path.join(
'prebid',
'_adapters.generated.ts',
);
const USER_IDS_FILE = path.join(
integrationsDir,
'prebid',
'_user_ids.generated.ts',
);

const DEFAULT_PREBID_USER_ID_MODULES = '';

/**
* Some User ID module names need explicit mapping instead of the default
* `name + 'IdSystem'` convention.
*/
const USER_ID_MODULE_OVERRIDES = {
connectId: ['connectIdSystem'],
identityLink: ['identityLinkIdSystem'],
sharedId: ['sharedIdSystem'],
unifiedId: ['unifiedIdSystem'],
liveIntent: ['liveIntentIdSystem'],
criteo: ['criteoIdSystem'],
uid2: ['uid2IdSystem'],
};

/**
* Check whether a candidate file uses CommonJS `require`, which is not supported
* by this browser bundle output mode.
*/
function hasRequireSyntax(filePath) {
try {
const source = fs.readFileSync(filePath, 'utf8');
return /\brequire\s*\(/.test(source);
} catch {
return false;
}
}

/**
* Generate `_adapters.generated.ts` with import statements for each adapter
Expand Down Expand Up @@ -105,7 +143,114 @@ function generatePrebidAdapters() {
console.log('[build-all] Prebid adapters:', adapterNames);
}

/**
* Generate `_user_ids.generated.ts` with import statements for each User ID
* submodule listed in TSJS_PREBID_USER_ID_MODULES.
*
* Invalid module names (those without a matching module file in
* prebid.js) are logged and skipped.
*/
function generatePrebidUserIdModules() {
const raw = process.env.TSJS_PREBID_USER_ID_MODULES || DEFAULT_PREBID_USER_ID_MODULES;
const names = raw
.split(',')
.map((s) => s.trim())
.filter(Boolean);

const modulesDir = path.join(
__dirname,
'node_modules',
'prebid.js',
'modules',
);
const modulesPublicDir = path.join(
__dirname,
'node_modules',
'prebid.js',
'dist',
'src',
'public',
);

const imports = [];
const loadedModuleNames = [];

for (const rawName of names) {
const candidateNames = USER_ID_MODULE_OVERRIDES[rawName]
? [...USER_ID_MODULE_OVERRIDES[rawName]]
: [
`${rawName}IdSystem`,
`${rawName}System`,
rawName,
];

let imported = false;
let skippedForUnsupportedSyntax = false;
for (const candidate of candidateNames) {
const moduleFile = `${candidate}.js`;
const modulePath = path.join(modulesDir, moduleFile);
const publicModulePath = path.join(modulesPublicDir, moduleFile);

const moduleFilePaths = [modulePath, publicModulePath].filter(fs.existsSync);
if (moduleFilePaths.length === 0) {
continue;
}

if (moduleFilePaths.some((candidatePath) => hasRequireSyntax(candidatePath))) {
console.error(
`[build-all] WARNING: Prebid user ID module "${rawName}" uses require() and is not supported in the TSJS bundle, skipping`,
);
skippedForUnsupportedSyntax = true;
break;
}

const importLine = `import 'prebid.js/modules/${moduleFile}';`;
if (!imports.includes(importLine)) {
imports.push(importLine);
loadedModuleNames.push(rawName);
} else if (!loadedModuleNames.includes(rawName)) {
loadedModuleNames.push(rawName);
}
imported = true;
break;
}

if (!imported && !skippedForUnsupportedSyntax) {
console.error(
`[build-all] WARNING: Prebid user ID module "${rawName}" not found, skipping`,
);
}
}

if (names.length > 0 && imports.length === 0) {
console.error(
'[build-all] WARNING: No valid Prebid user ID modules found, browser will rely on server-only IDs',
);
}

const content = [
'// Auto-generated by build-all.mjs — manual edits will be overwritten at build time.',
'//',
'// Controls which Prebid.js user ID modules are included in the bundle.',
'// Set the TSJS_PREBID_USER_ID_MODULES environment variable to a comma-separated',
'// list of module names (e.g. "connectId,criteo,sharedId") before building.',
`// Default: "${DEFAULT_PREBID_USER_ID_MODULES}"`,
'',
...imports,
'',
].join('\n');

fs.writeFileSync(USER_IDS_FILE, content);

if (names.length > 0) {
console.log('[build-all] Prebid user ID modules:', loadedModuleNames);
} else {
console.log('[build-all] Prebid user ID modules: []');
}
}

generatePrebidAdapters();
generatePrebidUserIdModules();

// ---------------------------------------------------------------------------

Expand Down
13 changes: 13 additions & 0 deletions crates/js/lib/src/integrations/prebid/_user_ids.generated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Auto-generated by build-all.mjs — manual edits will be overwritten at build time.
//
// Controls which Prebid.js user ID modules are included in the bundle.
// Set the TSJS_PREBID_USER_ID_MODULES environment variable to a comma-separated
// list of module names (e.g. "connectId,criteo,sharedId") before building.
// Default: ""

import 'prebid.js/modules/connectIdSystem.js';
import 'prebid.js/modules/criteoIdSystem.js';
import 'prebid.js/modules/identityLinkIdSystem.js';
import 'prebid.js/modules/uid2IdSystem.js';
import 'prebid.js/modules/sharedIdSystem.js';
import 'prebid.js/modules/unifiedIdSystem.js';
5 changes: 5 additions & 0 deletions crates/js/lib/src/integrations/prebid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ import 'prebid.js/modules/userId.js';
// Client-side bid adapters — self-register with prebid.js on import.
// The set of adapters is controlled by the TSJS_PREBID_ADAPTERS env var at
// build time. See _adapters.generated.ts (written by build-all.mjs).
// User ID submodules are controlled by TSJS_PREBID_USER_ID_MODULES.
// See _user_ids.generated.ts.
// When a bidder is listed in `client_side_bidders` in trusted-server.toml,
// the requestBids shim leaves its bids untouched and the corresponding
// adapter handles them natively in the browser.
import './_adapters.generated';
import './_user_ids.generated';

import { log } from '../../core/log';
import { buildAdRequest, parseAuctionResponse } from '../../core/auction';
Expand Down Expand Up @@ -451,6 +454,8 @@ function fitAuctionEidsToCookie(eids: AuctionEid[]): AuctionEid[] | undefined {
function syncPrebidEidsCookie(): void {
try {
if (typeof pbjs.getUserIdsAsEids !== 'function') {
// Without Prebid EIDs to forward, stale auction fallback IDs must not persist.
clearPrebidEidsCookie();
Comment thread
ChristianPavilonis marked this conversation as resolved.
return;
}

Expand Down
Loading
Loading