SAriyandath356188 (Community Member) asked a question.

Technology-Specific Input Validation Problems (CWE ID 100) - Class Constructor

 [Authorize]

  [RoutePrefix("accounts")]

  public class AccountsController : ApiController

  {

    private readonly IMembershipManager _membershipManager;

 

    public AccountsController(IMembershipManager membershipManager)

    {

      _membershipManager = membershipManager;

    }

}

 

public interface IMembershipManager

  {

    Task<ApplicationUserModel> Get(string username);

    Task CreateUser(ApplicationUserModel user);

    Task<bool> ChangePassword(ApplicationUserModel user, string newPassword);

  }

 

  public class ApplicationUserModel

  {

    [DataType(DataType.Text)]

    public string User { get; set; }

 

    [DataType(DataType.Text)]

    public string Password { get; set; }

 

    [DataType(DataType.Text)]

    public string NewPass { get; set; }

  }

 

In the above example, I'm getting Validation error for this line:  

public AccountsController(IMembershipManager membershipManager)

 

Can someone help me to fix this?

 

 


  • arichards (Veracode)

    CWE-100 can refer to a few types of input validation issues in models and controllers. Based off the code snippet provided, it is not clear which particular issue the scanner is referring to and is necessary to review the flaw details. To learn more about the identified flaw use the "Triage Flaws" view in the Veracode Platform from your application profile's static scan. From the "Triage Flaws" view, find the flaw and expand the "View Flaw Details" button. This will show the description as to why the scanner identified the flaw as well as the remediation to resolve the flaw. See screenshot example of the flaw details: https://help.veracode.com/r/review_static_flaw_viewer

     

    For more information on navigating the "Triage Flaws" view, see "Reviewing Static Flaws" in our help center: https://help.veracode.com/reader/DGHxSJy3Gn3gtuSIN2jkRQ/Mc06F6Q5hbJof3KFFZMs6A

     

    Please let us know if the remediation in "Triage Flaws" helps resolve your question.

    Expand Post
    Selected as Best
  • arichards (Veracode)

    CWE-100 can refer to a few types of input validation issues in models and controllers. Based off the code snippet provided, it is not clear which particular issue the scanner is referring to and is necessary to review the flaw details. To learn more about the identified flaw use the "Triage Flaws" view in the Veracode Platform from your application profile's static scan. From the "Triage Flaws" view, find the flaw and expand the "View Flaw Details" button. This will show the description as to why the scanner identified the flaw as well as the remediation to resolve the flaw. See screenshot example of the flaw details: https://help.veracode.com/r/review_static_flaw_viewer

     

    For more information on navigating the "Triage Flaws" view, see "Reviewing Static Flaws" in our help center: https://help.veracode.com/reader/DGHxSJy3Gn3gtuSIN2jkRQ/Mc06F6Q5hbJof3KFFZMs6A

     

    Please let us know if the remediation in "Triage Flaws" helps resolve your question.

    Expand Post
    Selected as Best
    • SAriyandath356188 (Community Member)

      Thanks for the information. Added a route constraint in action method and the issue is resolved.

       [Route("{username:min(1)}")]

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.