Skip to content

Suppress fabricated empty Prebid bidder params#910

Open
prk-Jr wants to merge 3 commits into
feat/ssat-render-inline-creativefrom
fix/prebid-suppress-empty-bidder-params
Open

Suppress fabricated empty Prebid bidder params#910
prk-Jr wants to merge 3 commits into
feat/ssat-render-inline-creativefrom
fix/prebid-suppress-empty-bidder-params

Conversation

@prk-Jr

@prk-Jr prk-Jr commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #899 (feat/ssat-render-inline-creative) — base branch is that PR's head, not main.

A configured Prebid bidder with no inline params and no matching bid-param override was expanded into "bidder": {} in the OpenRTB request. PBS rejects an empty bidder object, surfacing as the intermittent auction error.

Fix

In to_openrtb (crates/trusted-server-core/src/integrations/prebid.rs):

  • Track the bidders the publisher explicitly supplied (including an explicit empty {}).
  • Reorder to: build bidder map → apply overrides → drop fabricated empties → decide stored-request.
  • Drop any bidder still an empty object after overrides unless it was explicitly supplied.
  • Recompute the PBS stored-request fallback after the drop, so a slot whose configured bidders all resolve to fabricated empties falls back to the stored-request/no-bid path instead of shipping invalid bidder objects.

Behavior contract:

  • Absent bidder → dropped (never "bidder": {}).
  • Publisher-supplied {} → preserved (misconfiguration stays visible).
  • Bidder populated by a global/zone override → kept.
  • Valid bidders still ship even when a sibling has no params.
  • No eligible bidders → stored-request fallback.

The browser half of this defense (prevBidderParams retention on refresh) already shipped; this completes the server half.

Tests

New unit tests in prebid.rs:

  • to_openrtb_drops_fabricated_empty_bidder_params
  • to_openrtb_preserves_an_explicitly_empty_bidder
  • to_openrtb_keeps_a_fabricated_bidder_that_an_override_populates
  • to_openrtb_falls_back_to_stored_request_when_all_bidders_are_fabricated_empty

Verification

  • cargo fmt --all -- --check
  • cargo clippy-fastly
  • cargo test-fastly ✓ (1628 core + 99 fastly, 0 failed)
  • Other adapters (axum/cloudflare/spin) + clippy variants left to CI.

Test plan

  • CI green across all adapters
  • Manual: slot with a configured bidder lacking params no longer emits "bidder": {} to PBS

@prk-Jr prk-Jr marked this pull request as draft July 14, 2026 17:51
@prk-Jr prk-Jr self-assigned this Jul 14, 2026
A configured bidder with no inline params and no matching override
expanded to `"bidder": {}`, which PBS rejects. After applying overrides,
drop fabricated empty bidders, preserve an explicitly supplied empty
object so genuine misconfiguration stays visible, and fall back to the
stored-request path when no eligible bidders remain.
@prk-Jr prk-Jr force-pushed the fix/prebid-suppress-empty-bidder-params branch from d3fa16b to ef61953 Compare July 14, 2026 17:56
@prk-Jr prk-Jr marked this pull request as ready for review July 15, 2026 16:22
@ChristianPavilonis ChristianPavilonis requested review from ChristianPavilonis and aram356 and removed request for ChristianPavilonis July 15, 2026 16:47

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Approved with one non-blocking medium-severity finding documented inline. The primary fabricated-empty suppression, override ordering, and stored-request fallback behavior are covered by focused tests.

Please address the inline mixed-representation precedence case in follow-up work before relying on this path for clients that can send both direct bidder params and trustedServer.bidderParams.

Comment thread crates/trusted-server-core/src/integrations/prebid.rs Outdated

@aram356 aram356 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The fabricated-empty suppression, override ordering, stored-request fallback, and focused tests are otherwise sound, but mixed bidder representations can still recreate the invalid empty bidder object nondeterministically.

Blocking

🔧 wrench

  • Mixed bidder representations have nondeterministic precedence: direct bidder params can be overwritten by a fabricated empty object depending on HashMap iteration order (crates/trusted-server-core/src/integrations/prebid.rs:1440).

CI Status

  • GitHub integration checks: PASS (4/4)
  • fmt: PASS locally
  • focused native core tests: PASS (44/44)
  • Fastly test runtime: BLOCKED locally by unavailable macOS certificate keychain after successful compilation
  • clippy-fastly: BLOCKED locally by a build-script tooling error (Unrecognized option: 'p')
  • JS tests: not run; no JS/TS files changed

Comment thread crates/trusted-server-core/src/integrations/prebid.rs Outdated
A slot can carry both a direct bidder entry with valid inline params and a
trustedServer entry whose bidderParams omits that bidder. Because slot.bidders
is a HashMap, the trustedServer expansion (which fabricates an empty {} for the
omitted bidder) could run after the direct entry and overwrite its valid params
via extend. The direct entry already marked the bidder explicit, so the empty
object survived the retention drop and PBS rejected the impression — the failure
this path is meant to eliminate — nondeterministically, depending on iteration
order.

Replace the extend with an entry().or_insert() loop so trustedServer-expanded
bidders only fill in absent entries and direct params win regardless of order.
Add a looped regression test exercising a slot with both representations.
@prk-Jr prk-Jr requested a review from aram356 July 16, 2026 07:19
…' into fix/prebid-suppress-empty-bidder-params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants