Skip to content

SameSite=None without HTTPS should log warning #19939

@brockallen

Description

@brockallen

Describe the bug

When using SameSite=none, the Secure flag must also be set, otherwise the browser will ignore the cookie (tested in Chrome 80).

ASP.NET Core can issue a SameSite=none cookie without the Secure flag. For the cookie authentication handler configured with SameSite=none and when running over HTTP (not HTTPS) then the cookie authentication handler will emit a SameSite=none but no Secure flag (most likely because the SecurePolicy is SameAsRequest).

I'd imagine that the fix should be that when SameSite=none is configured but the request is not HTTPS, then SameSite flag should be omitted from the cookie.

To Reproduce

Use Chrome 80. Configure cookie authentication with SameSite=none and the default SecurePolicy. Try to issue the cookie (e.g. from a login page) and Chrome will issue a warning and ignore the cookie, and from the user's perspective they're not logged in. If you run over HTTPS then it works fine.

Tested in ASP.NET Core 3.1.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-authIncludes: Authn, Authz, OAuth, OIDC, Bearer

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions