Esempio n. 1
0
        public static VulnerabilityDetail Create(string filePath, System.Xml.XPath.XPathNavigator element, Enums.ScannerType category = Enums.ScannerType.None, string message = null)
        {
            string code = "OPT" + category.GetHashCode().ToString("D4");

            return(new VulnerabilityDetail
            {
                FilePath = filePath,
                CodeSnippet = element.OuterXml.Trim(),
                LineNumber = Mapper.Map.GetLineNumber(element),
                Code = code,
                Description = GetResourceString(code, "Description"),
                Message = string.IsNullOrWhiteSpace(message) ? GetResourceString(code, "MessageFormat") : message,
                Type = category,
                Title = GetResourceString(code, "Title")
            });
        }
Esempio n. 2
0
        public static VulnerabilityDetail Create(string filePath, SyntaxNodeOrToken codeSnippet, Enums.ScannerType category, string message = null)
        {
            string code = "OPT" + category.GetHashCode().ToString("D4");

            return(new VulnerabilityDetail
            {
                FilePath = filePath,
                CodeSnippet = codeSnippet.ToString(),
                LineNumber = Mapper.Map.GetLineNumber(codeSnippet),
                Code = code,
                Description = GetResourceString(code, "Description"),
                Message = string.IsNullOrWhiteSpace(message) ? GetResourceString(code, "MessageFormat") : message,
                Type = category,
                Title = GetResourceString(code, "Title")
            });
        }