如何解决批量分配:C# 中不安全的 Binder 配置API 滥用、结构化
**Getting the below HP fortify issue:
Mass Assignment:
Insecure Binder Configuration
(API Abuse,Structural)**
public class SampleModel
{
private SampleType sampleType;
private SampleMode sampleMode;
[JsonProperty("SampleType")]
public SampleType SampleType
{
get { return sampleType; }
set { sampleType= value; }
}
[JsonProperty("SampleMode")]
public Mode Mode
{
get { return sampleMode; }
set { sampleMode= value; }
}
public SampleModel(SampleType sampleType,SampleMode sampleMode)
{
this.sampleType= sampleType;
this.sampleMode= sampleMode;
}
}
[JsonConverter(typeof(StringEnumConverter))]
public enum SampleType
{
today= 1,tomorrow= 2,}
[JsonConverter(typeof(StringEnumConverter))]
public enum SampleMode
{
Jan= 1,Feb= 2,}
REST API POST 调用处理程序: 在此处获取 sampleNotification 参数中的问题。
[Route()]
public object Post([FromBody] SampleModel sampleNotification)
{
object response = HandleRemoteNotification(sampleNotification);
return response;
}
任何帮助,提前致谢
下面的问题我进入了 HP fortify。
使用提供自动模型绑定功能的框架时,最好控制哪些属性将绑定到模型对象,这样即使攻击者能够识别模型或嵌套类的其他未公开属性,他们将无法绑定来自 HTTP 请求参数的任意值。
用于将 HTTP 请求参数绑定到模型类的框架绑定器尚未明确配置为允许或禁止某些属性。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。