Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spec] Add directFromSellerSignals #771

Merged
merged 42 commits into from
Oct 13, 2023
Merged
Changes from 5 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d0ff938
Update spec.bs
caraitto Aug 29, 2023
4ef7e2b
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Aug 29, 2023
befdf66
Update spec.bs
caraitto Aug 29, 2023
82d5960
Update spec.bs
caraitto Aug 31, 2023
e0fedbb
Update spec.bs
caraitto Aug 31, 2023
c17aad7
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 5, 2023
e3c08aa
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 6, 2023
cac674b
Update spec.bs
caraitto Sep 6, 2023
57b47fc
Update spec.bs
caraitto Sep 6, 2023
481fb8d
Update spec.bs
caraitto Sep 6, 2023
37d2497
Update spec.bs
caraitto Sep 6, 2023
b812de5
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 8, 2023
9eeccb1
Update spec.bs
caraitto Sep 8, 2023
b11b751
Update spec.bs
caraitto Sep 8, 2023
d556834
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 8, 2023
71de0ba
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 11, 2023
f7dadb0
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 12, 2023
1ffc796
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 13, 2023
c5ffaef
Update spec.bs
caraitto Sep 13, 2023
ea2535f
Update spec.bs
caraitto Sep 13, 2023
eae73f5
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 14, 2023
b260071
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 15, 2023
a95a01a
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 15, 2023
2da7861
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 21, 2023
a32fb1a
Update spec.bs
caraitto Sep 23, 2023
5ecf0ca
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 23, 2023
ee1b5d6
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 25, 2023
48a0a4e
Update spec.bs
caraitto Sep 26, 2023
04653be
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 27, 2023
7d4dbed
Update spec.bs
caraitto Sep 27, 2023
15b5a6b
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 28, 2023
5640e41
Update spec.bs
caraitto Sep 28, 2023
9bbacb0
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Sep 29, 2023
fc199d1
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Oct 2, 2023
59e95db
Update spec.bs
caraitto Oct 5, 2023
8f4bedb
Update spec.bs
caraitto Oct 5, 2023
67e34e1
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Oct 10, 2023
f81ceff
Update spec.bs
caraitto Oct 10, 2023
b2f2cbe
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Oct 10, 2023
1b9696f
Merge branch 'main' of github.com:WICG/turtledove into dfss-header
caraitto Oct 11, 2023
c3b5bd7
Update spec.bs
caraitto Oct 11, 2023
76da2c9
Update spec.bs
caraitto Oct 12, 2023
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
140 changes: 140 additions & 0 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec: RFC8941; urlPrefix: https://httpwg.org/specs/rfc8941.html
text: structured header; url: top
for: structured header
text: integer; url: integer
text: boolean; url: boolean
spec: WebAssembly; urlPrefix: https://webassembly.github.io/spec/core/
type: dfn
urlPrefix: appendix/embedding.html
Expand Down Expand Up @@ -473,6 +474,7 @@ bid in the auction for the chance to display their advertisement.

<h3 id="runadauction">runAdAuction()</h3>

TODO: Promise wiring, pass results to worklets.
caraitto marked this conversation as resolved.
Show resolved Hide resolved
<xmp class="idl">
[SecureContext]
partial interface Navigator {
Expand All @@ -487,6 +489,7 @@ dictionary AuctionAdConfig {
Promise<any> auctionSignals;
Promise<any> sellerSignals;
Promise<USVString> directFromSellerSignals;
Promise<DOMString> directFromSellerSignalsHeaderAdSlot;
unsigned long long sellerTimeout;
unsigned short sellerExperimentGroupId;
USVString sellerCurrency;
Expand Down Expand Up @@ -2800,6 +2803,143 @@ This specification defines two [=policy-controlled features=] identified by the
Issue(WICG/turtledove#522): Move from "`*`" to "`self`".


# Handling Direct from Seller Signals # {#handling-direct-from-seller-signals}
caraitto marked this conversation as resolved.
Show resolved Hide resolved

This section specifies a manner by which signals may be provided to auctions such that the signals
are only used within their intended auction.

Scripts running on the page may peform a `fetch()` call using the `{adAuctionHeaders: true}`
caraitto marked this conversation as resolved.
Show resolved Hide resolved
option, which causes the value of the `Ad-Auction-Signals` response header on that request to
caraitto marked this conversation as resolved.
Show resolved Hide resolved
be used to provide signals in auctions running on the page whose seller matches the origin of the
`fetch()` destination.

<div algorithm="fetch adAuctionHeaders patch">
Modify [[FETCH]]'s [[FETCH#requests]] to add:
caraitto marked this conversation as resolved.
Show resolved Hide resolved

A [=request=] has an associated <dfn for=request>capture ad auction headers boolean</dfn>.
Unless stated otherwise it is false.
caraitto marked this conversation as resolved.
Show resolved Hide resolved

Modify [[FETCH]]'s <a href="https://fetch.spec.whatwg.org/#requestinit">RequestInit</a> dictionary to add
caraitto marked this conversation as resolved.
Show resolved Hide resolved
an adAuctionHeaders attribute:

<pre class=idl>
partial dictionary RequestInit {
boolean adAuctionHeaders;
};
</pre>

The following step will be added to the <a href="https://fetch.spec.whatwg.org/#dom-request">new Request(input, init) constructor steps</a>,
caraitto marked this conversation as resolved.
Show resolved Hide resolved
before step "Set this's [=Request/request=] to |request|":

1. If <var ignore=''>init</var>["{{RequestInit/adAuctionHeaders}}"] <a for=map>exists</a>, then set |request|'s
caraitto marked this conversation as resolved.
Show resolved Hide resolved
caraitto marked this conversation as resolved.
Show resolved Hide resolved
[=request/capture ad auction headers boolean=] to it.

The following step will be added to the <a href="https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch">HTTP-network-or-cache fetch</a>
caraitto marked this conversation as resolved.
Show resolved Hide resolved
algorithm, before step "Modify |httpRequest|'s [=request/header list=] per HTTP. ...":

1. If [=request=]'s [=request/capture ad auction headers boolean=] is true, then
[=header list/set a structured field value=] given «`Sec-Ad-Auction-Fetch`, the [=structured header/boolean=] ?1» in
|httpRequest|'s [=header list=].

Modify [[FETCH]]'s [[FETCH#infrastructure]] to add a new section called "Per Traversable Navigable Structures",
with the following content:

<h3 dfn-type=dfn>Direct from seller signals key</h3>
A direct from seller signals key is a [=struct=] with the following [=struct/items=]:
caraitto marked this conversation as resolved.
Show resolved Hide resolved

<dl dfn-for="direct from seller signals key">
: <dfn>owner</dfn>
:: An [=origin=]. Matches the origin that served the captured `Ad-Auction-Signals` header.
: <dfn>ad slot</dfn>
:: A [=string=]. Matches the `adSlot` key of the JSON dictionaries in the top level array of the
`Ad-Auction-Signals` value.

caraitto marked this conversation as resolved.
Show resolved Hide resolved
</dl>

<h3 dfn-type=dfn>Direct from seller signals</h3>
A direct from seller signals is a [=struct=] with the following [=struct/items=]:

<dl dfn-for="direct from seller signals">
: <dfn>seller signals</dfn>
:: Null or a [=string=].
Opaque JSON data passed to both buyers' and the seller's [=script runners=].
: <dfn>auction signals</dfn>
:: Null or a [=string=].
Opaque JSON data passed to the seller's [=script runner=].
: <dfn>per buyer signals</dfn>
:: A [=map=] whose [=map/keys=] are [=origins=] and whose [=map/values=] are [=strings=].
[=map/Keys=] are buyers and must be valid HTTPS origins. [=map/Values=] are opaque JSON data
passed to corresponding buyer's [=script runner=].

caraitto marked this conversation as resolved.
Show resolved Hide resolved
</dl>

Each [=traversable navigable=] has a <dfn>captured ad auction headers</dfn>, which is a [=map=]
caraitto marked this conversation as resolved.
Show resolved Hide resolved
caraitto marked this conversation as resolved.
Show resolved Hide resolved
whose [=map/keys=] are [=direct from seller signals keys=] and whose values are [=direct from seller signals=].
caraitto marked this conversation as resolved.
Show resolved Hide resolved

The following step will be added to the <a href="https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch">HTTP-network-or-cache fetch</a>
algorithm, before step "Return |response|.":

1. If |response| is not null, then run [=update captured headers=] with [=this=]'s
caraitto marked this conversation as resolved.
Show resolved Hide resolved
[=relevant global object=]'s [=associated Document's=] [=node navigable's=]
[=traversable navigable's=] [=captured ad auction headers=], |response|'s
[=response/header list=], and |request|'s [=request/URL=]'s [=url/origin=].

<div algorithm>
To <dfn>update captured headers</dfn> with a [=captured ad auction headers=] |storedHeaders|,
[=header list=] |responseHeaders|, and [=origin=] |requestOrigin|:
1. Let |adAuctionSignals| be the result of [=header list/get=] with "`Ad-Auction-Signals`",
|responseHeaders|.
1. If |adAuctionSignals| is null, return.
1. [=header list/delete=] "`Ad-Auction-Signals`" from |responseHeaders|.

NOTE: This step prevents the header value from being used outside the intended auctions.
caraitto marked this conversation as resolved.
Show resolved Hide resolved
1. Let |parsedSignals| be the result of [=parsing JSON bytes to an Infra value=], given
|adAuctionSignals|.
1. If |parsedSignals| is failure, return.
1. If |parsedSignals| is not a [=list=], return.
1. [=list/For each=] |signal| in |parsedSignals|:
1. If |signal| is not an [=ordered map=], [=iteration/continue=].
1. If |signal|["`adSlot`"] doesn't exist, [=iteration/continue=].
1. Create a new [=direct from seller signals key=] |signalsKey|, with its
[=direct from seller signals key/owner=] set to |requestOrigin| and its
[=direct from seller signals key/ad slot=] set to |signal|["`adSlot`"].
1. Create a new [=direct from seller signals=] |processedSignals|.
1. [=map/Remove=] |signal|["`adSlot`"].
1. [=map/For each=] |key| → |value| of |signal|:
1. Switch on |key|:
<dl class=switch>
<dt>"`sellerSignals`"
caraitto marked this conversation as resolved.
Show resolved Hide resolved
<dd>
1. Set |processedSignals|'s [=direct from seller signals/seller signals=] to the result
of [=serializing an Infra value to a JSON string=], given |value|. If this
[=exception/throws=], [=iteration/continue=].
caraitto marked this conversation as resolved.
Show resolved Hide resolved

<dt>"`auctionSignals`"
<dd>
1. Set |processedSignals|'s [=direct from seller signals/auction signals=] to the result
of [=serializing an Infra value to a JSON string=], given |value|. If this
[=exception/throws=], [=iteration/continue=].

<dt>"`perBuyerSignals`"
<dd>
1. If |value| is not an [=ordered map=], [=iteration/continue=].
1. For each |buyer| → |buyerSignals| of |value|:
1. Let |buyerOrigin| be the result of [=parsing an origin=] on |buyer|. If this
[=exception/throws=], [=iteration/continue=].
1. Let |buyerSignalsString| be the result of
[=serializing an Infra value to a JSON string=], given |buyerSignals|. If this
[=exception/throws=], [=iteration/continue=].
1. Set |processedSignals|'s [=direct from seller signals/per buyer signals=][|buyerOrigin|]
to |buyerSignalsString|.

</dl>

1. Set |storedHeaders|[|signalsKey|] to |processedSignals|.
</div>

</div>
caraitto marked this conversation as resolved.
Show resolved Hide resolved


# Structures # {#structures}

<xmp class="idl">
Expand Down