dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.89k stars 9.86k forks source link

Add support for Partitioned Cookies #55370

Open amcasey opened 2 months ago

amcasey commented 2 months ago

Background and Motivation

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

namespace Microsoft.Net.Http.Headers;

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

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

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

Usage Examples

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.

dotnet-policy-service[bot] commented 2 months ago

Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:

amcasey commented 2 months ago
amcasey commented 2 months ago

API approved

namespace Microsoft.Net.Http.Headers;

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

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

public class CookieOptions
{
+    public bool Partitioned { get; set; }
}
dotnet-policy-service[bot] commented 1 week ago

Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:

amcasey commented 1 week ago

(Updated labels on the wrong issue.)