Migrate StringContent sink to CSV format

This commit is contained in:
Tamas Vajk
2021-06-25 10:29:10 +02:00
parent 5aba7142e8
commit 2a75989881
2 changed files with 9 additions and 6 deletions

View File

@@ -87,6 +87,7 @@ private module Frameworks {
private import semmle.code.csharp.security.dataflow.flowsources.Local
private import semmle.code.csharp.security.dataflow.flowsinks.Html
private import semmle.code.csharp.dataflow.LibraryTypeDataFlow
private import semmle.code.csharp.security.dataflow.XSS
}
/**

View File

@@ -16,6 +16,7 @@ module XSS {
import semmle.code.csharp.security.dataflow.flowsources.Remote
private import semmle.code.csharp.dataflow.DataFlow2
private import semmle.code.csharp.dataflow.TaintTracking2
private import semmle.code.csharp.dataflow.ExternalFlow
/**
* Holds if there is tainted flow from `source` to `sink` that may lead to a
@@ -119,6 +120,10 @@ module XSS {
string explanation() { none() }
}
private class ExternalXssSink extends Sink {
ExternalXssSink() { sinkNode(this, "xss") }
}
/**
* A data flow source for cross-site scripting (XSS) vulnerabilities.
*/
@@ -406,12 +411,9 @@ module XSS {
/**
* An expression passed as the `content` argument to the constructor of `StringContent`.
*/
private class StringContent extends Sink {
StringContent() {
this.getExpr() =
any(ObjectCreation oc |
oc.getTarget().getDeclaringType().hasQualifiedName("System.Net.Http", "StringContent")
).getArgumentForName("content")
private class StringContentSinkModelCsv extends SinkModelCsv {
override predicate row(string row) {
row = ["System.Net.Http;StringContent;false;StringContent;;;Argument[0];xss"]
}
}
}