gpt4 book ai didi

c# - CheckMarx 中等严重性警告 - 启动时仅使用 HttpOnly cookie

转载 作者:行者123 更新时间:2023-12-05 02:04:01 32 4
gpt4 key购买 nike

CheckMarx 正在标记一个对我来说看起来像是误报的错误。我们的应用程序是用 C# 编写的,并使用 ASP.NET Core。

错误是:

The web application's Startup method creates a cookie Startup, at line 22 of Startup.cs, and returns it in the response. However, the application is not configured to automatically set the cookie with the "httpOnly" attribute, and the code does not explicitly add this to the cookie.

这是第 22 行:

public class Startup

我们确实正确设置了 cookie 政策:

app.UseCookiePolicy(new CookiePolicyOptions
{
HttpOnly = Microsoft.AspNetCore.CookiePolicy.HttpOnlyPolicy.Always
});

但 CheckMarx 仍在标记此警告。而且我不认为我的 Startup 类会创建一个名为 Startup 的 cookie。

我在这里找到了类似的帖子(未回复)- https://github.com/Azure/azure-functions-vs-build-sdk/issues/469 .

那么这是误报吗?我如何让 CheckMarx 停止标记它?

最佳答案

删除这些警告的唯一方法是将 Startup 类重命名为其他名称,例如 Startup123。

没有其他方法可以消除警告,我认为这绝对是误报。

关于c# - CheckMarx 中等严重性警告 - 启动时仅使用 HttpOnly cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64701912/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com