flipdoubt (Community Member) asked a question.

How to extract Javascript from CSHTML file in .NET 4.5 app?

We have an ASP.NET MVC 4.5 app that has Javascript sections embedded in CSHTML files, but CSHTML is not one of the file extensions listed for Javascript applications in the docs here. So here are my questions:

  1. Will embedding Javascript in CSHTML files fail the .NET static analysis scan?
  2. Can I submit CSHTML files to the Javascript scan even though it isn't in the list of support file extensions?
  3. If I cannot submit CSHTML files for Javascript scanning, can I change the file extension to HTML or another supported extension to scan embedded Javascript?

 


  • Hello @flipdoubt (Community Member)​ ,

     

    Unfortunately, the scanning is package-manager based (such as NPM), so we don't scan embedded JavaScript at the moment, so embedding Javascript in CSHTML files will cause the analysis scan to fail, and cannot submit CSHTML files to the Javascript scan because it isn't in the list of support file extensions.

     

    Please use the Help Center article that you referenced, Packaging JavaScript and TypeScript Applications for our supported file extensions. Another suggestion is adding that file type as an Idea in the Community because the more that the community supports an Idea, the more likely it will be considered or prioritized for implementation.

     

    Jason

    Veracode Support Engineer

    Expand Post
  • flipdoubt (Community Member)

    @Jason M., Veracode Support (Veracode)​ , thanks for your reply. Since HTML is listed as a valid extension to scan for Javascript, would it work if we change all CSHTML extensions to HTML for the purposes of Javascript scanning?

    • @flipdoubt (Community Member)​ ,

       

      If you change the extension to a package that we do support, it would allow extraction.

       

      Jason

      Veracode Support Engineer

      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.