NIdris603739 (Community Member) asked a question.

What's the possible Solution to this Improper Model Validation (CWE ID 1174) flaw?

I have a Particular File property that keeps giving an error once scanned by VeraCode, I have tried all possible option but I don't seem to get it right, the scan result says "The ASP.NET application does not use, or incorrectly uses, the model validation framework." Is there something I am missing?

 

private string _Action { get; set; }

 public string Action { get { return _Action; } set { if (value != null) _Action = value; } }

 

    [Required]

    [FileExtensions(Extensions = "csv,xlsx")]

    public IFormFile File { get; set; }

 

    

 

 


  • Anthony Fielding (Veracode)

    Hi @NIdris603739 (Community Member)​,

    The use of appropriate annotations from the System.ComponentModel.DataAnnotations namespace should be sufficient to resolve this flaw. It could be that other attributes exist without suitable annotations. I recommend scheduling a consultation with a Veracode Application Security Consultant to discuss this case further. You can find details on how to schedule a consultation here: https://help.veracode.com/reader/DGHxSJy3Gn3gtuSIN2jkRQ/7YQTCDJKFEQzL3gL_N90hQ.

     

    Thanks,

    Anthony Fielding

    Expand Post

Topics (3)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.