Skip to content

Commit f800256

Browse files
qingxinwuQingxin Wu
and
Qingxin Wu
authored
[Spec] Add private aggregation support for B&A response (#1344)
* start B&A PAgg. * progress * try to finish * add helper function. * address comments * remove server filtered field * address comments * pagg -> PAgg * PAgg -> private aggregation --------- Co-authored-by: Qingxin Wu <qingxinwu@google.com>
1 parent 39997bf commit f800256

File tree

1 file changed

+115
-16
lines changed

1 file changed

+115
-16
lines changed

spec.bs

Lines changed: 115 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,13 +1870,13 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
18701870
[=get direct from seller signals for a seller=] given |topLevelDirectFromSellerSignals|.
18711871
1. Set |topLevelDirectFromSellerSignalsRetrieved| to true.
18721872
1. If |compWinnerInfo|'s [=leading bid info/leading bid=] is not null, then run
1873-
[=score and rank a bid=] with |auctionConfig|, |reportingContextMap|[auctionConfig],
1873+
[=score and rank a bid=] with |auctionConfig|, |reportingContextMap|[|auctionConfig|],
18741874
|compWinnerInfo|'s [=leading bid info/leading bid=], |leadingBidInfo|,
18751875
|decisionLogicFetcher|, |trustedScoringSignalsBatcher|, null, "top-level-auction", null,
18761876
and |topLevelOrigin|.
18771877
1. If |compWinnerInfo|'s [=leading bid info/leading non-k-anon-enforced bid=]
18781878
is not null, then run [=score and rank a bid=] with |auctionConfig|, |reportingContextMap|[
1879-
auctionConfig], |compWinnerInfo|'s [=leading bid info/leading non-k-anon-enforced bid=],
1879+
|auctionConfig|], |compWinnerInfo|'s [=leading bid info/leading non-k-anon-enforced bid=],
18801880
|leadingBidInfo|, |decisionLogicFetcher|, |trustedScoringSignalsBatcher|,
18811881
|topLevelDirectFromSellerSignalsForSeller|, null, "top-level-auction", null, |topLevelOrigin|,
18821882
and |realTimeContributionsMap|.
@@ -3137,17 +3137,20 @@ a [=list=] of [=interest groups=] |bidIgs|, and a [=reporting context map=]
31373137
[=bid debug reporting info/bidder debug loss report url=] to |maybeDebugReportUrl|.
31383138
1. Set |bidDebugReportingInfo|'s [=bid debug reporting info/server filtered debugging only reports=]
31393139
to [=server auction response/server filtered debugging only reports=].
3140-
1. Set |reportingContextMap|[|auctionConfig|]'s [=reporting context/debug reporting info=] to
3140+
1. Let |reportingContext| be |reportingContextMap|[|auctionConfig|].
3141+
1. Set |reportingContext|'s [=reporting context/debug reporting info=] to
31413142
|bidDebugReportingInfo|.
31423143
1. Let |reportingId| be a [=reporting bid key=] with the following [=struct/items=]:
31433144
: [=reporting bid key/context=]
3144-
:: |reportingContextMap|[|auctionConfig|]
3145+
:: |reportingContext|
31453146
: [=reporting bid key/source=]
31463147
:: [=reporting bid source/bidding-and-auction-services=]
31473148
: [=reporting bid key/bidder origin=]
31483149
:: |response|'s [=server auction response/interest group owner=]
31493150
: [=reporting bid key/bid identifier=]
31503151
:: |response|'s [=server auction response/interest group name=]
3152+
1. [=Handle server response private aggregation fields=] given |response|, |requestContext| and
3153+
|reportingId|.
31513154
1. Let |winningBid| be a new [=generated bid=] with the following [=struct/items=]:
31523155
: [=generated bid/reporting id=]
31533156
:: |reportingId|
@@ -3247,6 +3250,67 @@ a [=list=] of [=interest groups=] |bidIgs|, and a [=reporting context map=]
32473250

32483251
</div>
32493252

3253+
<div algorithm>
3254+
To <dfn>handle server response private aggregation fields</dfn> given a [=server auction response=]
3255+
|response|, a [=reporting context=] |reportingContext|, and a [=reporting bid key=] |reportingId|:
3256+
3257+
1. [=Assert=] that these steps are running [=in parallel=].
3258+
1. [=Commit server response private aggregation contributions=] given |response|'s
3259+
[=server auction response/component win private aggregation contributions=], |reportingContext|,
3260+
and |reportingId|.
3261+
1. [=Commit server response private aggregation contributions=] given |response|'s
3262+
[=server auction response/server filtered private aggregation reserved contributions=],
3263+
|reportingContext|, and |reportingId|.
3264+
1. [=Commit server response private aggregation contributions=] given |response|'s
3265+
[=server auction response/server filtered private aggregation non reserved contributions=],
3266+
|reportingContext|, and |reportingId|.
3267+
3268+
</div>
3269+
3270+
<div algorithm>
3271+
To <dfn>commit server response private aggregation contributions</dfn> given a [=map=] from a
3272+
[=server auction private aggregation contribution key=] to a [=list=] of [=on event contribution entries=]
3273+
|contributionsMap|, a [=reporting context=] |reportingContext|, and a [=reporting bid key=]
3274+
|reportingId|:
3275+
3276+
1. [=map/For each=] |key| → |contributions| of |contributionsMap|:
3277+
1. Let |reportingOrigin| be |key|'s [=server auction private aggregation contribution key/reporting origin=].
3278+
1. Let |event| be |key|'s [=server auction private aggregation contribution key/event=].
3279+
1. Let |coordinator| be |key|'s [=server auction private aggregation contribution key/coordinator=].
3280+
1. If |coordinator| is null, set |coordinator| to the [=default aggregation coordinator=].
3281+
1. Let |eventToContributionsMap| be a new [=Private Aggregation contributions=].
3282+
1. Let |batchingScope| be null.
3283+
1. If |event| [=string/starts with=] "`reserved.`", set |batchingScope| to the
3284+
result of running [=get or create a batching scope=] given |reportingOrigin|, |coordinator| and
3285+
|reportingContext|.
3286+
3287+
Note: Each non-reserved |event| will have a different [=batching scope=] that is created later.
3288+
1. [=list/For each=] |contribution| of |contributions|:
3289+
1. [=Assert=] |contribution|["{{PAExtendedHistogramContribution/bucket}}"] is a {{bigint}} and
3290+
is [=set/contained=] in [=the exclusive range|the range=] 0 to 2<sup>128</sup>, exclusive.
3291+
1. [=Assert=] |contribution|["{{PAExtendedHistogramContribution/value}}"] is a {{long}}.
3292+
3293+
Note: All {{PAExtendedHistogramContribution/bucket}} and {{PAExtendedHistogramContribution/value}}
3294+
have been calculated on server side already.
3295+
1. Let |entry| be a new [=on event contribution entry=] with the items:
3296+
: [=on event contribution entry/contribution=]
3297+
:: |contribution|
3298+
: [=on event contribution entry/batching scope=]
3299+
:: |batchingScope|
3300+
: [=on event contribution entry/debug scope=]
3301+
:: A new [=debug scope=].
3302+
: [=on event contribution entry/worklet function=]
3303+
:: "`generate-bid`" (it does not matter for server returned contributions)
3304+
: [=on event contribution entry/origin=]
3305+
:: |reportingOrigin|
3306+
1. If |eventToContributionsMap|[|event|] does not [=map/exist=], set
3307+
|eventToContributionsMap|[|event|] to « |entry| ».
3308+
1. Otherwise, [=list/append=] |entry| to |eventToContributionsMap|[|event|].
3309+
1. [=Commit private aggregation contributions=] given |eventToContributionsMap|, |reportingId| and
3310+
|reportingContext|.
3311+
3312+
</div>
3313+
32503314
<h3 id="canloadadauctionfencedframe">canLoadAdAuctionFencedFrame()</h3>
32513315

32523316
*This first introductory paragraph is non-normative.*
@@ -3478,6 +3542,21 @@ A <dfn>server auction response</dfn> is a [=struct=] that contains auction resul
34783542
:: Null or [=server auction reporting info=].
34793543
: <dfn>component seller reporting</dfn>
34803544
:: Null or [=server auction reporting info=].
3545+
: <dfn>component win private aggregation contributions</dfn>
3546+
:: A [=map=] whose [=map/keys=] are [=server auction private aggregation contribution keys=], and
3547+
whose [=map/values=] are [=lists=] of [=on event contribution entries=]. Private aggregation
3548+
contributions from winners of component auctions run on trusted auction servers. These need to
3549+
be filtered by the client based on the top level auction's outcome.
3550+
: <dfn>server filtered private aggregation reserved contributions</dfn>
3551+
:: A [=map=] whose [=map/keys=] are [=server auction private aggregation contribution keys=], and
3552+
whose [=map/values=] are [=lists=] of [=on event contribution entries=]. Server filtered private
3553+
aggregation contributions with reserved event types (already set to "reserved.always"), which
3554+
are not dependent on the final auction result and should always be reported.
3555+
: <dfn>server filtered private aggregation non reserved contributions</dfn>
3556+
:: A [=map=] whose [=map/keys=] are [=server auction private aggregation contribution keys=], and
3557+
whose [=map/values=] are [=lists=] of [=on event contribution entries=]. Server filtered private
3558+
aggregation contributions with non reserved event types, which are not dependent on the final
3559+
auction result and should always be reported.
34813560
: <dfn>component win debugging only reports</dfn>
34823561
:: A [=map=] whose [=map/keys=] are [=server auction debug report keys=], and whose [=map/values=]
34833562
are [=lists=] of [=urls=].
@@ -3502,6 +3581,17 @@ a <dfn>server auction debug report key</dfn> is a [=struct=] with the following
35023581
:: A [=boolean=].
35033582
</dl>
35043583

3584+
a <dfn>server auction private aggregation contribution key</dfn> is a [=struct=] with the following
3585+
[=struct/items=]:
3586+
<dl dfn-for="server auction private aggregation contribution key">
3587+
: <dfn>reporting origin</dfn>
3588+
:: The [=origin=] of the script that contributed the contribution.
3589+
: <dfn>coordinator</dfn>
3590+
:: Null or an [=aggregation coordinator=].
3591+
: <dfn>event</dfn>
3592+
:: A [=string=].
3593+
</dl>
3594+
35053595
<div algorithm="getInterestGroupAdAuctionData()">
35063596

35073597
The <dfn for=Navigator method>getInterestGroupAdAuctionData(|configIDL|)</dfn> method steps are:
@@ -3531,18 +3621,22 @@ The <dfn for=Navigator method>getInterestGroupAdAuctionData(|configIDL|)</dfn> m
35313621
1. Set |config|'s [=auction data config/encryption key=] to |key|.
35323622
1. Set |config|'s [=auction data config/encryption key id=] to |keyId|.
35333623
1. Let |igMap| be a new [=map=] whose [=map/keys=] are [=origins=] and [=map/values=] are [=lists=].
3624+
1. Let |igPAggCoordinatorMap| be a new [=map=] whose [=map/keys=] are tuples of ([=origins=], [=strings=])
3625+
and [=map/values=] are [=origins=].
35343626
1. Let |startTime| be a [=moment=] equal to the [=current coarsened wall time=].
35353627
1. [=list/For each=] |ig| of the [=user agent=]'s [=interest group set=]:
35363628
1. If |ig|'s [=interest group/ads=] is null or [=list/is empty=], [=iteration/continue=].
35373629
1. Let |owner| be |ig|'s [=interest group/owner=].
3630+
1. Let |name| be |ig|'s [=interest group/name=].
35383631
1. If |config|'s [=auction data config/per buyer config=] [=map/is not empty=] and
35393632
|config|'s [=auction data config/per buyer config=][|owner|] does not
35403633
[=map/exist=], then [=iteration/continue=].
35413634
1. If |igMap|[|owner|] does not [=map/exist=], then [=map/set=] |igMap|[|owner|] to a new [=list=].
35423635
1. Let |ads| be a new [=list=].
35433636
1. [=list/For each=] |ad| in |ig|'s [=interest group/ads=], [=list/append=] |ad|'s [=interest group ad/ad render ID=] to |ads|.
35443637
1. Let |components| be a new [=list=].
3545-
1. [=list/For each=] |component| in |ig|'s [=interest group/ad components=], [=list/append=] |component|'s [=interest group ad/ad render ID=] to |components|.
3638+
1. [=list/For each=] |component| in |ig|'s [=interest group/ad components=], [=list/append=]
3639+
|component|'s [=interest group ad/ad render ID=] to |components|.
35463640
1. Let |prevWins| be a new <code>[=sequence=]<[=server auction previous win=]></code>.
35473641
1. [=list/For each=] |prevWin| of |ig|'s [=interest group/previous wins=] for all days within the
35483642
the last 30 days:
@@ -3567,7 +3661,7 @@ The <dfn for=Navigator method>getInterestGroupAdAuctionData(|configIDL|)</dfn> m
35673661
:: |prevWins|
35683662
1. Let |serverIg| be a new [=server auction interest group=] with the following [=struct/items=]:
35693663
: [=server auction interest group/name=]
3570-
:: |ig|'s [=interest group/name=]
3664+
:: |name|
35713665
: [=server auction interest group/bidding signals keys=]
35723666
:: |ig|'s [=interest group/trusted bidding signals keys=]
35733667
: [=server auction interest group/user bidding signals=]
@@ -3581,11 +3675,13 @@ The <dfn for=Navigator method>getInterestGroupAdAuctionData(|configIDL|)</dfn> m
35813675
: [=server auction interest group/priority=]
35823676
:: |ig|'s [=interest group/priority=]
35833677
1. [=list/Append=] |serverIg| to |igMap|[|owner|].
3678+
1. If |ig|'s [=interest group/Private Aggregation coordinator=] is not null, then [=map/set=]
3679+
|igPAggCoordinatorMap|[(|owner|, |name|)] to it.
35843680
1. Let |result| be a new {{AdAuctionData}}.
35853681
1. Let |requestId| be the [=string representation=] of a [=version 4 UUID=].
35863682
1. [=map/Set=] |result|["{{AdAuctionData/requestId}}"] to |requestId|.
3587-
1. Let (|requestBlob|, |context|) be the result of serializing |igMap| using
3588-
|config|. The serialization method may follow that described in
3683+
1. Let (|requestBlob|, |context|) be the result of serializing |igMap| with |config| and
3684+
|igPAggCoordinatorMap|. The serialization method may follow that described in
35893685
[Section 2.2.4 of Bidding and Auction Services](https://privacysandbox.github.io/draft-ietf-bidding-and-auction-services/draft-ietf-bidding-and-auction-services.html#name-generating-a-request).
35903686
1. Set |result|["{{AdAuctionData/request}}"] to |requestBlob|.
35913687
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |global|, to
@@ -4206,8 +4302,7 @@ A signal base value is one of the following:
42064302
: "<dfn><code>bid-reject-reason</code></dfn>"
42074303
:: The numeric value is an integer representing the reason a bid was rejected.
42084304

4209-
Note: this mapping to an integer is defined in [=determine a signal's
4210-
numeric value=].
4305+
Note: this mapping to an integer is defined in [=determine a signal's numeric value=].
42114306

42124307
: "<dfn><code>average-code-fetch-time</code></dfn>"
42134308
:: The numeric value is the average time it took to fetch code resources (JavaScript or WebAssembly)
@@ -4423,7 +4518,7 @@ runs; this method exists as an abstraction to help add that.
44234518
</div>
44244519

44254520
<div algorithm>
4426-
To <dfn>commit private aggregation contributions</dfn> given an [=Private Aggregation
4521+
To <dfn>commit private aggregation contributions</dfn> given a [=Private Aggregation
44274522
contributions=] |onEventMap|, a [=reporting bid key=] |bidKey|, and a [=reporting context=]
44284523
|reportingContext|:
44294524
1. [=map/For each=] |event| → |contributions| of |onEventMap|:
@@ -4465,6 +4560,7 @@ To <dfn>process the Private Aggregation contributions</dfn> given an [=auction c
44654560
<div algorithm>
44664561
To <dfn>process the Private Aggregation contributions for an auction</dfn> given
44674562
an [=auction config=] |auctionConfig| and a [=reporting context=] |reportingContext|:
4563+
44684564
1. If |auctionConfig|'s [=auction config/aborted=] is true, return.
44694565
1. Let |winnerId| be |reportingContext|'s [=reporting context/winner reporting id=]
44704566
1. Let |leadingBidInfo| be |reportingContext|'s [=reporting context/local leader info=].
@@ -4474,12 +4570,13 @@ an [=auction config=] |auctionConfig| and a [=reporting context=] |reportingCont
44744570
1. Let |sellerOnceRep| be null.
44754571
1. If |reportingContext|'s [=reporting context/seller participants=] [=set/is not empty=],
44764572
set |sellerOnceRep| to a random [=set/item=] of [=reporting context/seller participants=].
4477-
1. [=map/For each=] (|bidId|, |event|) → |contributions| of
4478-
|reportingContext|'s [=reporting context/private aggregation on event contributions=]:
4479-
1. If |event| is "`reserved.win`" or does not [=string/start with=] "`reserved.`":
4480-
1. If |bidId| is not |winnerId|, [=iteration/continue=].
4481-
1. If |event| is "`reserved.loss`" and |bidId| is |winnerId|, [=iteration/continue=].
4573+
1. [=map/For each=] (|bidId|, |event|) → |contributions| of |reportingContext|'s
4574+
[=reporting context/private aggregation on event contributions=]:
44824575
1. [=list/For each=] |onEventEntry| of |contributions|:
4576+
1. [=iteration/Continue=] if any of the following conditions hold:
4577+
* |event| is "`reserved.win`" and |bidId| is not |winnerId|;
4578+
* |event| does not [=string/start with=] "`reserved.`" and |bidId| is not |winnerId|;
4579+
* |event| is "`reserved.loss`" and |bidId| is |winnerId|.
44834580
1. If |event| is "`reserved.once`":
44844581
1. If |onEventEntry|'s [=on event contribution entry/worklet function=] is [=worklet function/
44854582
generate-bid=]:
@@ -6072,6 +6169,8 @@ event, PAExtendedHistogramContribution contribution)</dfn> method steps are:
60726169

60736170
Note: It is not currently possible to set a non-default filtering ID max
60746171
bytes for Protected Audience.
6172+
1. If |event| does not [=string/start with=] "`reserved.`", and |function| is
6173+
[=worklet function/score-ad=] or [=worklet function/report-result=], return.
60756174
1. Let |batchingScope| be null.
60766175
1. If |event| [=string/starts with=] "`reserved.`", set |batchingScope| to the
60776176
result of running |scopingDetails|' <a spec="private-aggregation-api" for="scoping details">

0 commit comments

Comments
 (0)