c# - What does Microsoft.Security.Application.Encoder.UrlPathEncode do? -


I found an HTML sensitizer using HTMLAgilitiePack. In the code, the Microsoft.Security.Application.Encoder class is used:

  // AntiXss a.Value = Microsoft.Security.Application.Encoder.UrlPathEncode (One price);  

I can not find assembly of this class, I do not want to have any other dependencies in my project, and without this line the sanitizer works. However removing this call can leave the security breach in the code.

In order to use or make decisions against this Assembly, I would like to know: What exactly does this method?

You can view

from the source code of the < / P>

  // / & lt; Summary & gt; The /// URL-encoded path path of a URL string and gives the encoded string. /// & lt; / Summary & gt; /// & lt; Ultimate name = "Input" & gt; URL path text & lt; / Param & gt; /// & lt; Returns & gt; URL path encoded text. & Lt; / Returns & gt; [System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Design", "CA1055: UriReturnValuesShouldNotBeStrings", justification = ". If it does not return a full URL then the return type may be a string")] public static string UrlPathEncode (string Input) {if (string.IsNullOrEmpty (Input)) {return input; } // DevDiv # 211105: The UrlPathEncode method should only encode the path portion of the URL. String plans and authorizations; String paths; String query endragment; Bool validUrl = UriUtil.TrySplitUriForPathEncode (Input, Plan and Authorized, Outside Path, Out Query Endraggement); If {// treated as a relative url, we may still need to discontinue the information / slice components schemeAndAuthority = null (validUrl!); UriUtil.ExtractQueryAndFragment (Input, Out of Line, Query Endragment); } Return Plan and Authority + HALPAMFire Encoder URL PathNencode (Path, Encoding.Utf 8) + Query Endragment; }  

You will have to move all the parts in URI encoding for better information. Generally I would recommend looking at whether the component is expected to see the unit test but there is no test on class at first sight: (


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -