dotnet / dotnet/aspnetcore

Add support for Partitioned Cookies

Open
#55,370 5 comments 0 reactions 0 assignees View on GitHub
api-approved area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

## Background and Motivation

[CHIPS](https://github.com/privacycg/CHIPS) is a draft for incrementally moving away from third-party cookies to improve privacy.

Feature request: https://github.com/dotnet/aspnetcore/issues/53224
PR: https://github.com/dotnet/aspnetcore/pull/55371

## Proposed API

```diff
namespace Microsoft.Net.Http.Headers;

public class SetCookieHeaderValue
{
+ public bool Partitioned { get; set; }
}
```
```diff
namespace Microsoft.AspNetCore.Http;

public class CookieBuilder
{
+ public virtual bool Partitioned { get; set; }
}

public class CookieOptions
{
+ public bool Partitioned { get; set; }
}
```

## Usage Examples

```csharp
IResponseCookies responseCookies;
responseCookies.Append("cookieName", "cookieValue", new CookieOptions
{
Partitioned = true,
SameSite = SameSiteMode.None,
Secure = true,
});
```

You can also use a `CookieBuilder`, but that won't do any validation (as for `Same-Site`).

## Alternative Designs

n/a

## Risks

I understand the CHIPS spec isn't actually finalized.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.