@@ -175,21 +175,37 @@ The discovery mechanism is as follows:
175175
1761766. The server responds with a ``200 OK `` status code and a body
177177 containing a JSON object if the index supports Trusted Publishing
178- for the given upload URL. The JSON object **MUST ** contain the following
178+ for the given upload URL.
179+
180+ The JSON object **MUST ** contain the following
179181 fields:
180182
181183 - ``audience-endpoint ``: a string containing the URL of the OIDC
182184 audience endpoint to be used during token exchange.
183185 - ``token-mint-endpoint ``: a string containing the URL of the
184186 token minting endpoint to be used during token exchange.
185187
188+ Additionally, the JSON object **MAY ** contain the following fields:
189+
190+ - ``features ``: an array of strings indicating optional features
191+ supported by the index's Trusted Publishing implementation.
192+ The set of possible features is defined under `<Feature Negotiation _>`__.
193+
194+ - ``default-features ``: an array of strings indicating the default
195+ features used by the index's Trusted Publishing implementation
196+ if a request does not explicitly specify any features.
197+ If the ``default-features `` field is not present, the uploading client
198+ **MUST ** assume a default of ``["multi-use-token"] ``.
199+
186200 For the above example, a valid response body would be:
187201
188202 .. code-block :: json
189203
190204 {
191205 "audience-endpoint" : " https://upload.example.com/_/oidc/audience" ,
192- "token-mint-endpoint" : " https://upload.example.com/_/oidc/mint-token"
206+ "token-mint-endpoint" : " https://upload.example.com/_/oidc/mint-token" ,
207+ "features" : [" single-use-token" , " multi-use-token" ],
208+ "default-features" : [" multi-use-token" ]
193209 }
194210
195211 If the server does not support Trusted Publishing for the given
@@ -250,6 +266,20 @@ POST request **MUST** be a JSON object containing the following:
250266
251267- ``token ``: a string containing the identity credential
252268 obtained from the Trusted Publishing provider.
269+ - ``features ``: an **optional ** array of strings
270+ indicating the desired features for the minted upload credential.
271+ If this field is not provided by the client, the server **MUST ** use
272+ its own default features as specified in the
273+ ``default-features `` field during discovery.
274+
275+ For example, a valid request body would be:
276+
277+ .. code-block :: json
278+
279+ {
280+ "token" : " ey..." ,
281+ "features" : [" single-use-token" ]
282+ }
253283
254284 On success, the server responds with a ``200 OK `` status code and a body
255285containing a JSON object with the following fields:
@@ -275,6 +305,32 @@ containing a JSON object with the following fields:
275305On failure, the server **MUST ** respond with any standard HTTP
276306error code in the 400 or 500 range to indicate the appropriate error condition.
277307
308+ Feature Negotiation
309+ ~~~~~~~~~~~~~~~~~~~
310+
311+ The protocol defined in this PEP supports an *optional * mechanism for
312+ negotiating non-default features between the uploading client and the
313+ receiving index server. These features are advertised as an array of
314+ strings in the ``features `` field of the discovery response; the client
315+ can then request one or more features by including them in the ``features ``
316+ field of the token minting request.
317+
318+ The following features are defined:
319+
320+ - ``single-use-token ``: the tokens minted by the index server
321+ **MUST ** be single-use tokens. In other words, the token returned
322+ by the token minting endpoint **MUST ** only be usable for a single
323+ upload operation. Any subsequent upload attempts using the same
324+ token **MUST ** be rejected by the index server. Clients that request
325+ the ``single-use-token `` feature **MUST ** be prepared to perform
326+ multiple token minting operations if multiple upload operations
327+ are needed.
328+
329+ - ``multi-use-token ``: the tokens minted by the index server
330+ **MUST ** be multi-use tokens. In other words, the token returned
331+ by the token minting endpoint **MAY ** be usable for multiple
332+ upload operations until it expires.
333+
278334Security Implications
279335=====================
280336
0 commit comments