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

Rpc http cookie behavior on V3 #5331

Merged
merged 6 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/WebJobs.Script/WebJobs.Script.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.7.0" />
<PackageReference Include="Grpc.Core" Version="1.20.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.10120001-f33e57bd" />
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.5.2-SNAPSHOT" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="2.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ private static SameSiteMode RpcSameSiteEnumConverter(RpcHttpCookie.Types.SameSit
case RpcHttpCookie.Types.SameSite.Lax:
return SameSiteMode.Lax;
case RpcHttpCookie.Types.SameSite.None:
return SameSiteMode.None;
mhoeger marked this conversation as resolved.
Show resolved Hide resolved
return SameSiteMode.Unspecified;
default:
return SameSiteMode.None;
return SameSiteMode.Unspecified;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ public async Task AddsHttpCookies()
{
new Tuple<string, string, CookieOptions>("firstCookie", "cookieValue", new CookieOptions()
{
SameSite = SameSiteMode.None
SameSite = SameSiteMode.Lax
}),
new Tuple<string, string, CookieOptions>("secondCookie", "cookieValue2", new CookieOptions()
{
Path = "/",
HttpOnly = true,
MaxAge = TimeSpan.FromSeconds(20)
MaxAge = TimeSpan.FromSeconds(20),
SameSite = SameSiteMode.Unspecified
})
}
};
Expand All @@ -78,7 +79,7 @@ public async Task AddsHttpCookies()
context.HttpContext.Response.Headers.TryGetValue("Set-Cookie", out StringValues cookies);

Assert.Equal(2, cookies.Count);
Assert.Equal("firstCookie=cookieValue; path=/; samesite=none", cookies[0]);
Assert.Equal("firstCookie=cookieValue; path=/; samesite=lax", cookies[0]);
// TODO: https://github.com/Azure/azure-functions-host/issues/4890
Assert.Equal("secondCookie=cookieValue2; max-age=20; path=/; httponly", cookies[1]);
}
Expand Down