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 30 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
191 changes: 191 additions & 0 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Assume Explicit For: yes
</pre>

<pre class="anchors">
urlPrefix: https://fetch.spec.whatwg.org/; spec: Fetch
type: dfn
text: HTTP-network-or-cache fetch; url: #concept-http-network-or-cache-fetch
text: task destination; for: fetch params; url: fetch-params-task-destination
urlPrefix: https://www.ietf.org/rfc/rfc4122.txt
type: dfn; text: urn uuid
urlPrefix: https://github.com/WICG/turtledove/blob/main/FLEDGE_k_anonymity_server.md
Expand All @@ -42,6 +46,7 @@ spec: RFC8941; urlPrefix: https://httpwg.org/specs/rfc8941.html
for: structured header
text: boolean; url: boolean
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 @@ -521,6 +526,8 @@ bid in the auction for the chance to display their advertisement.

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

TODO: Promise wiring, pass results to worklets. This is being done in
https://github.com/WICG/turtledove/pull/774.
<xmp class="idl">
[SecureContext]
partial interface Navigator {
Expand All @@ -535,6 +542,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 @@ -2941,6 +2949,189 @@ 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 {{WindowOrWorkerGlobalScope/fetch()}} call using the
caraitto marked this conversation as resolved.
Show resolved Hide resolved
{{RequestInit/adAuctionHeaders}} option, which causes the value of the [:Ad-Auction-Signals:]
response header for that [=request=] to be used to provide signals in auctions running on the page
caraitto marked this conversation as resolved.
Show resolved Hide resolved
whose seller matches the origin of the {{WindowOrWorkerGlobalScope/fetch()}} destination.

<div algorithm="fetch capture adAuctionHeaders boolean patch">
Modify the definition of a [=request=]:

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

<div algorithm="fetch capture adAuctionHeaders RequestInit patch">
Modify [[FETCH]]'s {{RequestInit}} dictionary to add an adAuctionHeaders attribute:

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

<div algorithm="fetch new request patch">
The following step will be added to the <code><a constructor for="Request" lt="Request()">
new Request (<var ignore>input</var>, <var ignore>init</var>)</a></code> constructor steps, before
step "Set [=this=]'s [=Request/request=] to |request|":

1. If <var ignore>init</var>["{{RequestInit/adAuctionHeaders}}"] [=map/exists=], then set
|request|'s [=request/capture-ad-auction-headers=] to it.

</div>

<div algorithm="fetch Sec-Ad-Auction-Fetch patch">
The following step will be added to the [=HTTP-network-or-cache fetch=] algorithm, before step
"Modify |httpRequest|'s [=request/header list=] per HTTP. ...":

1. If [=request=]'s [=request/capture-ad-auction-headers=] 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=].

</div>

<div algorithm="fetch per traversable navigable structures patch">
Modify [[FETCH]]'s [[FETCH#infrastructure]] to add a new section called "Per Traversable Navigable
Structures", with the following content:

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

NOTE: This is only captured during a {{WindowOrWorkerGlobalScope/fetch()}} call with the
`{adAuctionHeaders: true}` option, as described in the [:Ad-Auction-Signals:] header description.

<dl dfn-for="direct from seller signals key">
: <dfn>seller</dfn>
:: An [=origin=]. Matches the origin that served the captured [:Ad-Auction-Signals:] header.
caraitto marked this conversation as resolved.
Show resolved Hide resolved
: <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

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

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

NOTE: This is only captured during a {{WindowOrWorkerGlobalScope/fetch()}} call with the
`{adAuctionHeaders: true}` option, as described in the [:Ad-Auction-Signals:] header description.

<dl dfn-for="direct from seller signals">
: <dfn>auction signals</dfn>
:: Null or a [=string=].
Opaque JSON data passed to both buyers' and the seller's [=script runners=].
: <dfn>seller 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 for="traversable navigable">captured ad auction headers
</dfn>, which is a [=map=] whose [=map/keys=] are [=direct from seller signals keys=] and whose
[=map/values=] are [=direct from seller signals=].
</div>

<div algorithm="fetch auction headers patch">
The following will be added to [[Fetch#http-extensions]]:

<h3 id=sec-ad-auction-fetch-header>The \`<a http-header><code>Sec-Ad-Auction-Fetch</code></a>\` HTTP
request header</h3>

The \`<dfn http-header><code>Sec-Ad-Auction-Fetch</code></dfn>\` request header is an optional
caraitto marked this conversation as resolved.
Show resolved Hide resolved
[=structured header=] with of type [=structured header/boolean=]. If equal to `?1`, the user agent
will remove any [:Ad-Auction-Signals:] from the response returned to
{{WindowOrWorkerGlobalScope/fetch()}} -- the [:Ad-Auction-Signals:] value will instead only be used
in Protected Audiences auctions. [:Sec-Ad-Auction-Fetch:] will only be set if the
{{WindowOrWorkerGlobalScope/fetch()}} call was made with the `{adAuctionHeaders: true}` option.

<h3 id=ad-auction-signals-header>The \`<a http-header><code>Ad-Auction-Signals</code></a>\` HTTP
response header</h3>

The \`<dfn http-header><code>Ad-Auction-Signals</code></dfn>\` response header provides value
of a JSON array of dictionaries, each with an `adSlot` key. Protected Audience non-component,
component, and top-level auctions may specify which signals to load by the `adSlot` key.
</div>

<div algorithm="fetch auction signals response patch">
The following step will be added to the [=HTTP-network-or-cache fetch=] algorithm, before step
"Return |response|.":

1. If |response| is not null, and |fetchParams|'s [=fetch params/task destination=] is a [=global
object=], then run [=update captured headers=] with |fetchParams|'s [=fetch params/task
destination=]'s [=associated Document's=] [=node navigable's=] [=traversable navigable's=]
[=traversable navigable/captured ad auction headers=], |response|'s [=response/header list=], and
<var ignore>request</var>'s [=request/URL=]'s [=url/origin=].

</div>

<div algorithm="fetch update captured headers patch">
The following algorithm will be added to the [[FETCH#fetching]] section:

<h3 id=update-captured-headers>Update captured headers</h3>

To <dfn id=concept-update-captured-headers>update captured headers</dfn> with a [=traversable
navigable/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:],
caraitto marked this conversation as resolved.
Show resolved Hide resolved
|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 --
that is, scripts making the {{WindowOrWorkerGlobalScope/fetch()}} request aren't able to load
the header value.
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/seller=] 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`"
<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|.

<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|.

<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|.
1. Set |processedSignals|'s
[=direct from seller signals/per buyer signals=][|buyerOrigin|] to |buyerSignalsString|.

</dl>

1. Set |storedHeaders|[|signalsKey|] to |processedSignals|.

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


# Structures # {#structures}

<xmp class="idl">
Expand Down