1

我已对我的应用程序运行安全检查,并收到以下警告:

“Parser.GenerateJeffpReport(string)”调用具有 LinkDemand 的“Process.Start()”。通过进行此调用,“Process.Start()”间接暴露给用户代码。查看以下可能公开绕过安全保护的方法的调用堆栈:

我google了一下,发现了这个问题:

这个安全警告是什么意思(.Net Process 类)?

我尝试按照推荐的答案来做,即将我的方法设置为:

[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")] 

但是,我收到以下警告:

Microsoft.Security:“Parser.ParseJeff(string)”受“PermissionSetAttribute”的 LinkDemand 保护。在 2 级安全规则集中,应该通过安全关键来保护它。删除 LinkDemand 并标记“Parser.ParseJeff(string)”安全关键。

我该怎么办?无论如何,这一切的意义是什么?为什么这是一个安全问题?我根本没有在这个主题上找到有用的微软文档。

4

2 回答 2

2

代替

[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")] 

[安全关键]

SecurityCriticalAttribute 相当于完全信任的链接需求。标有 SecurityCriticalAttribute 的类型或成员只能由完全受信任的代码调用;它不必要求特定的权限。它不能被部分受信任的代码调用。

于 2012-05-01T12:00:29.740 回答
0

您也可以使用[PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")].

于 2015-07-30T19:39:07.800 回答