mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Fix standalone tests
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
@namespace test
|
||||
@page
|
||||
|
||||
@model UserData
|
||||
@{
|
||||
}
|
||||
|
||||
@if (Model != null)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
@using test
|
||||
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@@ -0,0 +1 @@
|
||||
| Views/Test/Test.cshtml:7:27:7:36 | access to property Name | Controllers/TestController.cs:13:40:13:47 | tainted1 : UserData | Views/Test/Test.cshtml:7:27:7:36 | access to property Name | $@ flows to here and is written to HTML or JavaScript: Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.Raw() method. | Controllers/TestController.cs:13:40:13:47 | tainted1 : UserData | User-provided value |
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @name Cross-site scripting
|
||||
* @description Writing user input directly to a web page
|
||||
* allows for a cross-site scripting vulnerability.
|
||||
* @kind path-problem
|
||||
* @problem.severity error
|
||||
* @security-severity 6.1
|
||||
* @precision high
|
||||
* @id cs/web/xss
|
||||
* @tags security
|
||||
* external/cwe/cwe-079
|
||||
* external/cwe/cwe-116
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import semmle.code.csharp.security.dataflow.XSSQuery
|
||||
|
||||
// import PathGraph // exclude query predicates with output dependant on the absolute filepath the tests are run in
|
||||
from XssNode source, XssNode sink, string message
|
||||
where xssFlow(source, sink, message)
|
||||
select sink, source, sink, "$@ flows to here and " + message, source, "User-provided value"
|
||||
@@ -1 +0,0 @@
|
||||
Security Features/CWE-079/XSS.ql
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -69,9 +69,11 @@ class RazorPageClass extends Class {
|
||||
AssemblyAttribute attr;
|
||||
|
||||
RazorPageClass() {
|
||||
this.getBaseClass()
|
||||
.getUnboundDeclaration()
|
||||
.hasQualifiedName("Microsoft.AspNetCore.Mvc.Razor", "RazorPage<>") and
|
||||
exists(Class baseClass | baseClass = this.getBaseClass().getUnboundDeclaration() |
|
||||
baseClass.hasQualifiedName("Microsoft.AspNetCore.Mvc.Razor", "RazorPage<>")
|
||||
or
|
||||
baseClass.hasQualifiedName("Microsoft.AspNetCore.Mvc.RazorPages", "Page")
|
||||
) and
|
||||
attr.getFile() = this.getFile() and
|
||||
attr.getType()
|
||||
.hasQualifiedName("Microsoft.AspNetCore.Razor.Hosting", "RazorCompiledItemAttribute")
|
||||
|
||||
Reference in New Issue
Block a user