mirror of
https://github.com/github/codeql.git
synced 2026-02-12 05:01:06 +01:00
Merge pull request #21055 from owen-mc/java/allow-mad-barriers
Java: allow MaD barriers
This commit is contained in:
@@ -35,6 +35,11 @@ private class DefaultIntentRedirectionSink extends IntentRedirectionSink {
|
||||
DefaultIntentRedirectionSink() { sinkNode(this, "intent-redirection") }
|
||||
}
|
||||
|
||||
/** An external sanitizer for Intent redirection vulnerabilities. */
|
||||
private class ExternalIntentRedirectionSanitizer extends IntentRedirectionSanitizer {
|
||||
ExternalIntentRedirectionSanitizer() { barrierNode(this, "intent-redirection") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A default sanitizer for `Intent` nodes dominated by calls to `ComponentName.getPackageName`
|
||||
* and `ComponentName.getClassName`. These are used to check whether the origin or destination
|
||||
|
||||
@@ -37,6 +37,10 @@ private class DefaultCommandInjectionSink extends CommandInjectionSink {
|
||||
DefaultCommandInjectionSink() { sinkNode(this, "command-injection") }
|
||||
}
|
||||
|
||||
private class ExternalCommandInjectionSanitizer extends CommandInjectionSanitizer {
|
||||
ExternalCommandInjectionSanitizer() { barrierNode(this, "command-injection") }
|
||||
}
|
||||
|
||||
private class DefaultCommandInjectionSanitizer extends CommandInjectionSanitizer {
|
||||
DefaultCommandInjectionSanitizer() {
|
||||
this instanceof SimpleTypeSanitizer
|
||||
|
||||
@@ -49,6 +49,15 @@ private class DefaultFragmentInjectionSink extends FragmentInjectionSink {
|
||||
DefaultFragmentInjectionSink() { sinkNode(this, "fragment-injection") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A sanitizer for Fragment injection vulnerabilities.
|
||||
*/
|
||||
abstract class FragmentInjectionSanitizer extends DataFlow::Node { }
|
||||
|
||||
private class ExternalFragmentInjectionSanitizer extends FragmentInjectionSanitizer {
|
||||
ExternalFragmentInjectionSanitizer() { barrierNode(this, "fragment-injection") }
|
||||
}
|
||||
|
||||
private class DefaultFragmentInjectionAdditionalTaintStep extends FragmentInjectionAdditionalTaintStep
|
||||
{
|
||||
override predicate step(DataFlow::Node n1, DataFlow::Node n2) {
|
||||
|
||||
@@ -14,6 +14,8 @@ module FragmentInjectionTaintConfig implements DataFlow::ConfigSig {
|
||||
|
||||
predicate isSink(DataFlow::Node sink) { sink instanceof FragmentInjectionSink }
|
||||
|
||||
predicate isBarrier(DataFlow::Node node) { node instanceof FragmentInjectionSanitizer }
|
||||
|
||||
predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) {
|
||||
any(FragmentInjectionAdditionalTaintStep c).step(n1, n2)
|
||||
}
|
||||
|
||||
@@ -26,6 +26,13 @@ private class DefaultGroovyInjectionSink extends GroovyInjectionSink {
|
||||
DefaultGroovyInjectionSink() { sinkNode(this, "groovy-injection") }
|
||||
}
|
||||
|
||||
/** A data flow sanitizer for Groovy expression injection vulnerabilities. */
|
||||
abstract class GroovyInjectionSanitizer extends DataFlow::ExprNode { }
|
||||
|
||||
private class ExternalGroovyInjectionSanitizer extends GroovyInjectionSanitizer {
|
||||
ExternalGroovyInjectionSanitizer() { barrierNode(this, "groovy-injection") }
|
||||
}
|
||||
|
||||
/** A set of additional taint steps to consider when taint tracking Groovy related data flows. */
|
||||
private class DefaultGroovyInjectionAdditionalTaintStep extends GroovyInjectionAdditionalTaintStep {
|
||||
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
|
||||
|
||||
@@ -289,8 +289,8 @@ private Method getSourceMethod(Method m) {
|
||||
result = m
|
||||
}
|
||||
|
||||
private class DefaultPathInjectionSanitizer extends PathInjectionSanitizer {
|
||||
DefaultPathInjectionSanitizer() { barrierNode(this, "path-injection") }
|
||||
private class ExternalPathInjectionSanitizer extends PathInjectionSanitizer {
|
||||
ExternalPathInjectionSanitizer() { barrierNode(this, "path-injection") }
|
||||
}
|
||||
|
||||
/** Holds if `g` is a guard that checks for `..` components. */
|
||||
|
||||
@@ -118,8 +118,8 @@ private class ContainsUrlSanitizer extends RequestForgerySanitizer {
|
||||
}
|
||||
}
|
||||
|
||||
private class DefaultRequestForgerySanitizer extends RequestForgerySanitizer {
|
||||
DefaultRequestForgerySanitizer() { barrierNode(this, "request-forgery") }
|
||||
private class ExternalRequestForgerySanitizer extends RequestForgerySanitizer {
|
||||
ExternalRequestForgerySanitizer() { barrierNode(this, "request-forgery") }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,8 @@ class TrustBoundaryViolationSink extends DataFlow::Node {
|
||||
*/
|
||||
abstract class TrustBoundaryValidationSanitizer extends DataFlow::Node { }
|
||||
|
||||
private class DefaultTrustBoundaryValidationSanitizer extends TrustBoundaryValidationSanitizer {
|
||||
DefaultTrustBoundaryValidationSanitizer() { barrierNode(this, "trust-boundary-violation") }
|
||||
private class ExternalTrustBoundaryValidationSanitizer extends TrustBoundaryValidationSanitizer {
|
||||
ExternalTrustBoundaryValidationSanitizer() { barrierNode(this, "trust-boundary-violation") }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,8 +54,8 @@ private class DefaultXssSink extends XssSink {
|
||||
}
|
||||
}
|
||||
|
||||
private class DefaultXssSanitizer extends XssSanitizer {
|
||||
DefaultXssSanitizer() { barrierNode(this, ["html-injection", "js-injection"]) }
|
||||
private class ExternalXssSanitizer extends XssSanitizer {
|
||||
ExternalXssSanitizer() { barrierNode(this, ["html-injection", "js-injection"]) }
|
||||
}
|
||||
|
||||
/** A sanitizer that considers numeric and boolean typed data safe for writing to output. */
|
||||
|
||||
@@ -21,8 +21,8 @@ private class DefaultRegexInjectionSink extends RegexInjectionSink {
|
||||
}
|
||||
}
|
||||
|
||||
private class DefaultRegexInjectionSanitizer extends RegexInjectionSanitizer {
|
||||
DefaultRegexInjectionSanitizer() { barrierNode(this, "regex-use") }
|
||||
private class ExternalRegexInjectionSanitizer extends RegexInjectionSanitizer {
|
||||
ExternalRegexInjectionSanitizer() { barrierNode(this, "regex-use") }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user