Java: Re-factor most queries and tests to use threat models.

This commit is contained in:
Michael Nebel
2023-10-04 14:01:58 +02:00
parent f0fb065446
commit 40e63a63e2
74 changed files with 105 additions and 91 deletions

View File

@@ -30,7 +30,7 @@ deprecated class IntentRedirectionConfiguration extends TaintTracking::Configura
/** A taint tracking configuration for tainted Intents being used to start Android components. */ /** A taint tracking configuration for tainted Intents being used to start Android components. */
module IntentRedirectionConfig implements DataFlow::ConfigSig { module IntentRedirectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof IntentRedirectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof IntentRedirectionSink }
@@ -57,7 +57,7 @@ private class OriginalIntentSanitizer extends IntentRedirectionSanitizer {
* flowing directly to sinks that start Android components. * flowing directly to sinks that start Android components.
*/ */
private module SameIntentBeingRelaunchedConfig implements DataFlow::ConfigSig { private module SameIntentBeingRelaunchedConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof IntentRedirectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof IntentRedirectionSink }
@@ -93,7 +93,7 @@ private class IntentWithTaintedComponent extends DataFlow::Node {
* A taint tracking configuration for tainted data flowing to an `Intent`'s component. * A taint tracking configuration for tainted data flowing to an `Intent`'s component.
*/ */
private module TaintedIntentComponentConfig implements DataFlow::ConfigSig { private module TaintedIntentComponentConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
any(IntentSetComponent setComponent).getSink() = sink.asExpr() any(IntentSetComponent setComponent).getSink() = sink.asExpr()

View File

@@ -74,7 +74,7 @@ class ExternalApkSource extends DataFlow::Node {
sourceNode(this, "android-external-storage-dir") or sourceNode(this, "android-external-storage-dir") or
this.asExpr().(MethodAccess).getMethod() instanceof UriConstructorMethod or this.asExpr().(MethodAccess).getMethod() instanceof UriConstructorMethod or
this.asExpr().(StringLiteral).getValue().matches("file://%") or this.asExpr().(StringLiteral).getValue().matches("file://%") or
this instanceof RemoteFlowSource this instanceof ThreatModelFlowSource
} }
} }

View File

@@ -6,7 +6,7 @@ private import semmle.code.java.security.ArithmeticCommon
/** A taint-tracking configuration to reason about overflow from unvalidated user input. */ /** A taint-tracking configuration to reason about overflow from unvalidated user input. */
module RemoteUserInputOverflowConfig implements DataFlow::ConfigSig { module RemoteUserInputOverflowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { overflowSink(_, sink.asExpr()) } predicate isSink(DataFlow::Node sink) { overflowSink(_, sink.asExpr()) }
@@ -17,7 +17,7 @@ module RemoteUserInputOverflowConfig implements DataFlow::ConfigSig {
/** A taint-tracking configuration to reason about underflow from unvalidated user input. */ /** A taint-tracking configuration to reason about underflow from unvalidated user input. */
module RemoteUserInputUnderflowConfig implements DataFlow::ConfigSig { module RemoteUserInputUnderflowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { underflowSink(_, sink.asExpr()) } predicate isSink(DataFlow::Node sink) { underflowSink(_, sink.asExpr()) }

View File

@@ -52,7 +52,7 @@ private class DefaultCommandInjectionSanitizer extends CommandInjectionSanitizer
* A taint-tracking configuration for unvalidated user input that is used to run an external process. * A taint-tracking configuration for unvalidated user input that is used to run an external process.
*/ */
module RemoteUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { module RemoteUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjectionSink }

View File

@@ -57,7 +57,7 @@ deprecated class ConditionalBypassFlowConfig extends TaintTracking::Configuratio
* A taint tracking configuration for untrusted data flowing to sensitive conditions. * A taint tracking configuration for untrusted data flowing to sensitive conditions.
*/ */
module ConditionalBypassFlowConfig implements DataFlow::ConfigSig { module ConditionalBypassFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { conditionControlsMethod(_, sink.asExpr()) } predicate isSink(DataFlow::Node sink) { conditionControlsMethod(_, sink.asExpr()) }

View File

@@ -106,10 +106,10 @@ deprecated class UntrustedDataToExternalApiConfig extends TaintTracking::Configu
} }
/** /**
* Taint tracking configuration for flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. * Taint tracking configuration for flow from `ThreatModelFlowSource`s to `ExternalApiDataNode`s.
*/ */
module UntrustedDataToExternalApiConfig implements DataFlow::ConfigSig { module UntrustedDataToExternalApiConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode } predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
} }

View File

@@ -8,7 +8,7 @@ private import semmle.code.java.StringFormat
* A taint-tracking configuration for externally controlled format string vulnerabilities. * A taint-tracking configuration for externally controlled format string vulnerabilities.
*/ */
module ExternallyControlledFormatStringConfig implements DataFlow::ConfigSig { module ExternallyControlledFormatStringConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
sink.asExpr() = any(StringFormat formatCall).getFormatArgument() sink.asExpr() = any(StringFormat formatCall).getFormatArgument()

View File

@@ -28,7 +28,7 @@ deprecated class FragmentInjectionTaintConf extends TaintTracking::Configuration
* that is used to create Android fragments dynamically. * that is used to create Android fragments dynamically.
*/ */
module FragmentInjectionTaintConfig implements DataFlow::ConfigSig { module FragmentInjectionTaintConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof FragmentInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof FragmentInjectionSink }

View File

@@ -28,7 +28,7 @@ deprecated class GroovyInjectionConfig extends TaintTracking::Configuration {
* that is used to evaluate a Groovy expression. * that is used to evaluate a Groovy expression.
*/ */
module GroovyInjectionConfig implements DataFlow::ConfigSig { module GroovyInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof GroovyInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof GroovyInjectionSink }

View File

@@ -5,10 +5,11 @@ private import semmle.code.java.security.internal.ArraySizing
private import semmle.code.java.dataflow.FlowSources private import semmle.code.java.dataflow.FlowSources
/** /**
* A taint-tracking configuration to reason about improper validation of user-provided size used for array construction. * A taint-tracking configuration to reason about improper validation of
* user-provided size used for array construction.
*/ */
module ImproperValidationOfArrayConstructionConfig implements DataFlow::ConfigSig { module ImproperValidationOfArrayConstructionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
any(CheckableArrayAccess caa).canThrowOutOfBoundsDueToEmptyArray(sink.asExpr(), _) any(CheckableArrayAccess caa).canThrowOutOfBoundsDueToEmptyArray(sink.asExpr(), _)
@@ -16,7 +17,8 @@ module ImproperValidationOfArrayConstructionConfig implements DataFlow::ConfigSi
} }
/** /**
* Taint-tracking flow for improper validation of user-provided size used for array construction. * Taint-tracking flow for improper validation of user-provided size used
* for array construction.
*/ */
module ImproperValidationOfArrayConstructionFlow = module ImproperValidationOfArrayConstructionFlow =
TaintTracking::Global<ImproperValidationOfArrayConstructionConfig>; TaintTracking::Global<ImproperValidationOfArrayConstructionConfig>;

View File

@@ -5,10 +5,11 @@ private import semmle.code.java.security.internal.ArraySizing
private import semmle.code.java.dataflow.FlowSources private import semmle.code.java.dataflow.FlowSources
/** /**
* A taint-tracking configuration to reason about improper validation of user-provided array index. * A taint-tracking configuration to reason about improper validation
* of user-provided array index.
*/ */
module ImproperValidationOfArrayIndexConfig implements DataFlow::ConfigSig { module ImproperValidationOfArrayIndexConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
any(CheckableArrayAccess caa).canThrowOutOfBounds(sink.asExpr()) any(CheckableArrayAccess caa).canThrowOutOfBounds(sink.asExpr())

View File

@@ -46,7 +46,7 @@ class SetMessageInterpolatorCall extends MethodAccess {
* to the argument of a method that builds constraint error messages. * to the argument of a method that builds constraint error messages.
*/ */
module BeanValidationConfig implements DataFlow::ConfigSig { module BeanValidationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof BeanValidationSink } predicate isSink(DataFlow::Node sink) { sink instanceof BeanValidationSink }
} }

View File

@@ -39,7 +39,7 @@ deprecated class IntentUriPermissionManipulationConf extends TaintTracking::Conf
* A taint tracking configuration for user-provided Intents being returned to third party apps. * A taint tracking configuration for user-provided Intents being returned to third party apps.
*/ */
module IntentUriPermissionManipulationConfig implements DataFlow::ConfigSig { module IntentUriPermissionManipulationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof IntentUriPermissionManipulationSink } predicate isSink(DataFlow::Node sink) { sink instanceof IntentUriPermissionManipulationSink }

View File

@@ -63,7 +63,7 @@ deprecated class JexlInjectionConfig extends TaintTracking::Configuration {
* It supports both JEXL 2 and 3. * It supports both JEXL 2 and 3.
*/ */
module JexlInjectionConfig implements DataFlow::ConfigSig { module JexlInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof JexlEvaluationSink } predicate isSink(DataFlow::Node sink) { sink instanceof JexlEvaluationSink }

View File

@@ -33,7 +33,7 @@ deprecated class JndiInjectionFlowConfig extends TaintTracking::Configuration {
* A taint-tracking configuration for unvalidated user input that is used in JNDI lookup. * A taint-tracking configuration for unvalidated user input that is used in JNDI lookup.
*/ */
module JndiInjectionFlowConfig implements DataFlow::ConfigSig { module JndiInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof JndiInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof JndiInjectionSink }

View File

@@ -8,7 +8,7 @@ import semmle.code.java.security.LdapInjection
* A taint-tracking configuration for unvalidated user input that is used to construct LDAP queries. * A taint-tracking configuration for unvalidated user input that is used to construct LDAP queries.
*/ */
module LdapInjectionFlowConfig implements DataFlow::ConfigSig { module LdapInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof LdapInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof LdapInjectionSink }

View File

@@ -27,7 +27,7 @@ deprecated class LogInjectionConfiguration extends TaintTracking::Configuration
* A taint-tracking configuration for tracking untrusted user input used in log entries. * A taint-tracking configuration for tracking untrusted user input used in log entries.
*/ */
module LogInjectionConfig implements DataFlow::ConfigSig { module LogInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof LogInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof LogInjectionSink }

View File

@@ -32,7 +32,7 @@ deprecated class MvelInjectionFlowConfig extends TaintTracking::Configuration {
* that is used to construct and evaluate a MVEL expression. * that is used to construct and evaluate a MVEL expression.
*/ */
module MvelInjectionFlowConfig implements DataFlow::ConfigSig { module MvelInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof MvelEvaluationSink } predicate isSink(DataFlow::Node sink) { sink instanceof MvelEvaluationSink }

View File

@@ -85,7 +85,7 @@ private predicate smallExpr(Expr e) {
* numeric cast. * numeric cast.
*/ */
module NumericCastFlowConfig implements DataFlow::ConfigSig { module NumericCastFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
sink.asExpr() = any(NumericNarrowingCastExpr cast).getExpr() and sink.asExpr() = any(NumericNarrowingCastExpr cast).getExpr() and

View File

@@ -29,7 +29,7 @@ deprecated class OgnlInjectionFlowConfig extends TaintTracking::Configuration {
* A taint-tracking configuration for unvalidated user input that is used in OGNL EL evaluation. * A taint-tracking configuration for unvalidated user input that is used in OGNL EL evaluation.
*/ */
module OgnlInjectionFlowConfig implements DataFlow::ConfigSig { module OgnlInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof OgnlInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof OgnlInjectionSink }

View File

@@ -29,7 +29,7 @@ deprecated class PartialPathTraversalFromRemoteConfig extends TaintTracking::Con
* and remains vulnerable to Partial Path Traversal. * and remains vulnerable to Partial Path Traversal.
*/ */
module PartialPathTraversalFromRemoteConfig implements DataFlow::ConfigSig { module PartialPathTraversalFromRemoteConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } predicate isSource(DataFlow::Node node) { node instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node node) { predicate isSink(DataFlow::Node node) {
any(PartialPathTraversalMethodAccess ma).getQualifier() = node.asExpr() any(PartialPathTraversalMethodAccess ma).getQualifier() = node.asExpr()

View File

@@ -37,7 +37,7 @@ deprecated class RequestForgeryConfiguration extends TaintTracking::Configuratio
*/ */
module RequestForgeryConfig implements DataFlow::ConfigSig { module RequestForgeryConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource and source instanceof ThreatModelFlowSource and
// Exclude results of remote HTTP requests: fetching something else based on that result // Exclude results of remote HTTP requests: fetching something else based on that result
// is no worse than following a redirect returned by the remote server, and typically // is no worse than following a redirect returned by the remote server, and typically
// we're requesting a resource via https which we trust to only send us to safe URLs. // we're requesting a resource via https which we trust to only send us to safe URLs.

View File

@@ -9,7 +9,7 @@ import semmle.code.java.security.ResponseSplitting
*/ */
module ResponseSplittingConfig implements DataFlow::ConfigSig { module ResponseSplittingConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource and source instanceof ThreatModelFlowSource and
not source instanceof SafeHeaderSplittingSource not source instanceof SafeHeaderSplittingSource
} }

View File

@@ -18,7 +18,7 @@ private class ResultReceiverSendCall extends MethodAccess {
} }
private module UntrustedResultReceiverConfig implements DataFlow::ConfigSig { private module UntrustedResultReceiverConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } predicate isSource(DataFlow::Node node) { node instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node node) { predicate isSink(DataFlow::Node node) {
node.asExpr() = any(ResultReceiverSendCall c).getReceiver() node.asExpr() = any(ResultReceiverSendCall c).getReceiver()

View File

@@ -29,7 +29,7 @@ deprecated class SpelInjectionConfig extends TaintTracking::Configuration {
* that is used to construct and evaluate a SpEL expression. * that is used to construct and evaluate a SpEL expression.
*/ */
module SpelInjectionConfig implements DataFlow::ConfigSig { module SpelInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof SpelExpressionEvaluationSink } predicate isSink(DataFlow::Node sink) { sink instanceof SpelExpressionEvaluationSink }

View File

@@ -52,7 +52,7 @@ private class TaintPreservingUriCtorParam extends Parameter {
* A taint-tracking configuration for tracking flow from remote sources to the creation of a path. * A taint-tracking configuration for tracking flow from remote sources to the creation of a path.
*/ */
module TaintedPathConfig implements DataFlow::ConfigSig { module TaintedPathConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sinkNode(sink, "path-injection") } predicate isSink(DataFlow::Node sink) { sinkNode(sink, "path-injection") }

View File

@@ -62,7 +62,7 @@ abstract class TemplateInjectionSanitizerWithState extends DataFlow::Node {
abstract predicate hasState(DataFlow::FlowState state); abstract predicate hasState(DataFlow::FlowState state);
} }
private class DefaultTemplateInjectionSource extends TemplateInjectionSource instanceof RemoteFlowSource private class DefaultTemplateInjectionSource extends TemplateInjectionSource instanceof ThreatModelFlowSource
{ } { }
private class DefaultTemplateInjectionSink extends TemplateInjectionSink { private class DefaultTemplateInjectionSink extends TemplateInjectionSink {

View File

@@ -12,7 +12,8 @@ private import semmle.code.java.frameworks.owasp.Esapi
*/ */
abstract class TrustBoundaryViolationSource extends DataFlow::Node { } abstract class TrustBoundaryViolationSource extends DataFlow::Node { }
private class RemoteSource extends TrustBoundaryViolationSource instanceof RemoteFlowSource { } private class ThreatModelSource extends TrustBoundaryViolationSource instanceof ThreatModelFlowSource
{ }
/** /**
* A sink for data that crosses a trust boundary. * A sink for data that crosses a trust boundary.

View File

@@ -27,7 +27,7 @@ deprecated class FetchUntrustedResourceConfiguration extends TaintTracking::Conf
* A taint configuration tracking flow from untrusted inputs to a resource fetching call. * A taint configuration tracking flow from untrusted inputs to a resource fetching call.
*/ */
module FetchUntrustedResourceConfig implements DataFlow::ConfigSig { module FetchUntrustedResourceConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof UrlResourceSink } predicate isSink(DataFlow::Node sink) { sink instanceof UrlResourceSink }

View File

@@ -30,7 +30,7 @@ deprecated class UnsafeContentResolutionConf extends TaintTracking::Configuratio
* A taint-tracking configuration to find paths from remote sources to content URI resolutions. * A taint-tracking configuration to find paths from remote sources to content URI resolutions.
*/ */
module UnsafeContentResolutionConfig implements DataFlow::ConfigSig { module UnsafeContentResolutionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof ContentUriResolutionSink } predicate isSink(DataFlow::Node sink) { sink instanceof ContentUriResolutionSink }

View File

@@ -324,7 +324,7 @@ deprecated class UnsafeDeserializationConfig extends TaintTracking::Configuratio
/** Tracks flows from remote user input to a deserialization sink. */ /** Tracks flows from remote user input to a deserialization sink. */
private module UnsafeDeserializationConfig implements DataFlow::ConfigSig { private module UnsafeDeserializationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof UnsafeDeserializationSink } predicate isSink(DataFlow::Node sink) { sink instanceof UnsafeDeserializationSink }
@@ -448,7 +448,7 @@ deprecated class UnsafeTypeConfig extends TaintTracking2::Configuration {
* If this is user-controlled, arbitrary code could be executed while instantiating the user-specified type. * If this is user-controlled, arbitrary code could be executed while instantiating the user-specified type.
*/ */
module UnsafeTypeConfig implements DataFlow::ConfigSig { module UnsafeTypeConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof UnsafeTypeSink } predicate isSink(DataFlow::Node sink) { sink instanceof UnsafeTypeSink }

View File

@@ -8,7 +8,7 @@ private import semmle.code.java.security.UrlRedirect
* A taint-tracking configuration for reasoning about URL redirections. * A taint-tracking configuration for reasoning about URL redirections.
*/ */
module UrlRedirectConfig implements DataFlow::ConfigSig { module UrlRedirectConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof UrlRedirectSink } predicate isSink(DataFlow::Node sink) { sink instanceof UrlRedirectSink }
} }

View File

@@ -9,7 +9,7 @@ private import semmle.code.java.security.XPath
* A taint-tracking configuration for reasoning about XPath injection vulnerabilities. * A taint-tracking configuration for reasoning about XPath injection vulnerabilities.
*/ */
module XPathInjectionConfig implements DataFlow::ConfigSig { module XPathInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof XPathInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof XPathInjectionSink }
} }

View File

@@ -31,7 +31,7 @@ deprecated class XsltInjectionFlowConfig extends TaintTracking::Configuration {
* A taint-tracking configuration for unvalidated user input that is used in XSLT transformation. * A taint-tracking configuration for unvalidated user input that is used in XSLT transformation.
*/ */
module XsltInjectionFlowConfig implements DataFlow::ConfigSig { module XsltInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof XsltInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof XsltInjectionSink }

View File

@@ -28,7 +28,7 @@ deprecated class XxeConfig extends TaintTracking::Configuration {
* A taint-tracking configuration for unvalidated remote user input that is used in XML external entity expansion. * A taint-tracking configuration for unvalidated remote user input that is used in XML external entity expansion.
*/ */
module XxeConfig implements DataFlow::ConfigSig { module XxeConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof XxeSink } predicate isSink(DataFlow::Node sink) { sink instanceof XxeSink }

View File

@@ -66,7 +66,7 @@ deprecated predicate hasPolynomialReDoSResult(
/** A configuration for Polynomial ReDoS queries. */ /** A configuration for Polynomial ReDoS queries. */
module PolynomialRedosConfig implements DataFlow::ConfigSig { module PolynomialRedosConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(SuperlinearBackTracking::PolynomialBackTrackingTerm regexp | exists(SuperlinearBackTracking::PolynomialBackTrackingTerm regexp |

View File

@@ -24,7 +24,7 @@ deprecated class RegexInjectionConfiguration extends TaintTracking::Configuratio
* A taint-tracking configuration for untrusted user input used to construct regular expressions. * A taint-tracking configuration for untrusted user input used to construct regular expressions.
*/ */
module RegexInjectionConfig implements DataFlow::ConfigSig { module RegexInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof RegexInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof RegexInjectionSink }

View File

@@ -43,7 +43,7 @@ class Log4jInjectionSanitizer extends DataFlow::Node {
* A taint-tracking configuration for tracking untrusted user input used in log entries. * A taint-tracking configuration for tracking untrusted user input used in log entries.
*/ */
module Log4jInjectionConfig implements DataFlow::ConfigSig { module Log4jInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof Log4jInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof Log4jInjectionSink }

View File

@@ -33,7 +33,7 @@ class UrlConstructor extends ClassInstanceExpr {
} }
module RemoteUrlToOpenStreamFlowConfig implements DataFlow::ConfigSig { module RemoteUrlToOpenStreamFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(MethodAccess m | exists(MethodAccess m |

View File

@@ -48,7 +48,7 @@ class NormalizedPathNode extends DataFlow::Node {
} }
module InjectFilePathConfig implements DataFlow::ConfigSig { module InjectFilePathConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
sinkNode(sink, "path-injection") and sinkNode(sink, "path-injection") and

View File

@@ -14,7 +14,7 @@
import CommandInjectionRuntimeExec import CommandInjectionRuntimeExec
import ExecUserFlow::PathGraph import ExecUserFlow::PathGraph
class RemoteSource extends Source instanceof RemoteFlowSource { } class ThreatModelSource extends Source instanceof ThreatModelFlowSource { }
from from
ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink, DataFlow::Node sourceCmd, ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink, DataFlow::Node sourceCmd,

View File

@@ -20,7 +20,7 @@ import semmle.code.java.dataflow.TaintTracking
import MyBatisAnnotationSqlInjectionFlow::PathGraph import MyBatisAnnotationSqlInjectionFlow::PathGraph
private module MyBatisAnnotationSqlInjectionConfig implements DataFlow::ConfigSig { private module MyBatisAnnotationSqlInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof MyBatisAnnotatedMethodCallArgument } predicate isSink(DataFlow::Node sink) { sink instanceof MyBatisAnnotatedMethodCallArgument }

View File

@@ -20,7 +20,7 @@ import semmle.code.java.dataflow.FlowSources
import MyBatisMapperXmlSqlInjectionFlow::PathGraph import MyBatisMapperXmlSqlInjectionFlow::PathGraph
private module MyBatisMapperXmlSqlInjectionConfig implements DataFlow::ConfigSig { private module MyBatisMapperXmlSqlInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof MyBatisMapperMethodCallAnArgument } predicate isSink(DataFlow::Node sink) { sink instanceof MyBatisMapperMethodCallAnArgument }

View File

@@ -18,7 +18,7 @@ import semmle.code.java.dataflow.TaintTracking
import BeanShellInjectionFlow::PathGraph import BeanShellInjectionFlow::PathGraph
module BeanShellInjectionConfig implements DataFlow::ConfigSig { module BeanShellInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof BeanShellInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof BeanShellInjectionSink }

View File

@@ -18,7 +18,7 @@ import semmle.code.java.dataflow.TaintTracking
import JShellInjectionFlow::PathGraph import JShellInjectionFlow::PathGraph
module JShellInjectionConfig implements DataFlow::ConfigSig { module JShellInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof JShellInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof JShellInjectionSink }

View File

@@ -8,7 +8,7 @@ import semmle.code.java.dataflow.TaintTracking
* that is used to construct and evaluate an expression. * that is used to construct and evaluate an expression.
*/ */
module JakartaExpressionInjectionConfig implements DataFlow::ConfigSig { module JakartaExpressionInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof ExpressionEvaluationSink } predicate isSink(DataFlow::Node sink) { sink instanceof ExpressionEvaluationSink }

View File

@@ -99,17 +99,17 @@ class CodeInjectionSink extends DataFlow::ExprNode {
} }
/** /**
* A taint configuration for tracking flow from `RemoteFlowSource` to a Jython method call * A taint configuration for tracking flow from `ThreatModelFlowSource` to a Jython method call
* `CodeInjectionSink` that executes injected code. * `CodeInjectionSink` that executes injected code.
*/ */
module CodeInjectionConfig implements DataFlow::ConfigSig { module CodeInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof CodeInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof CodeInjectionSink }
} }
/** /**
* Taint tracking flow from `RemoteFlowSource` to a Jython method call * Taint tracking flow from `ThreatModelFlowSource` to a Jython method call
* `CodeInjectionSink` that executes injected code. * `CodeInjectionSink` that executes injected code.
*/ */
module CodeInjectionFlow = TaintTracking::Global<CodeInjectionConfig>; module CodeInjectionFlow = TaintTracking::Global<CodeInjectionConfig>;

View File

@@ -131,11 +131,11 @@ class ScriptInjectionSink extends DataFlow::ExprNode {
} }
/** /**
* A taint tracking configuration that tracks flow from `RemoteFlowSource` to an argument * A taint tracking configuration that tracks flow from `ThreatModelFlowSource` to an argument
* of a method call that executes injected script. * of a method call that executes injected script.
*/ */
module ScriptInjectionConfig implements DataFlow::ConfigSig { module ScriptInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof ScriptInjectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof ScriptInjectionSink }
} }

View File

@@ -42,7 +42,7 @@ class PortletRenderRequestMethod extends Method {
*/ */
module SpringViewManipulationConfig implements DataFlow::ConfigSig { module SpringViewManipulationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource or source instanceof ThreatModelFlowSource or
source instanceof WebRequestSource or source instanceof WebRequestSource or
source.asExpr().(MethodAccess).getMethod() instanceof PortletRenderRequestMethod source.asExpr().(MethodAccess).getMethod() instanceof PortletRenderRequestMethod
} }

View File

@@ -19,7 +19,7 @@ import AndroidWebResourceResponse
import InsecureWebResourceResponseFlow::PathGraph import InsecureWebResourceResponseFlow::PathGraph
module InsecureWebResourceResponseConfig implements DataFlow::ConfigSig { module InsecureWebResourceResponseConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof WebResourceResponseSink } predicate isSink(DataFlow::Node sink) { sink instanceof WebResourceResponseSink }

View File

@@ -148,7 +148,7 @@ private predicate updateMessageDigestStep(DataFlow2::Node fromNode, DataFlow2::N
* such as cipher, MAC or signature. * such as cipher, MAC or signature.
*/ */
private module UserInputInCryptoOperationConfig implements DataFlow::ConfigSig { private module UserInputInCryptoOperationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(ProduceCryptoCall call | call.getQualifier() = sink.asExpr()) exists(ProduceCryptoCall call | call.getQualifier() = sink.asExpr())
@@ -214,7 +214,7 @@ private class NonConstantTimeComparisonCall extends StaticMethodAccess {
* that compare inputs using a non-constant-time algorithm. * that compare inputs using a non-constant-time algorithm.
*/ */
private module UserInputInComparisonConfig implements DataFlow::ConfigSig { private module UserInputInComparisonConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(NonConstantTimeEqualsCall call | exists(NonConstantTimeEqualsCall call |

View File

@@ -63,7 +63,7 @@ module CorsSourceReachesCheckConfig implements DataFlow::ConfigSig {
module CorsSourceReachesCheckFlow = TaintTracking::Global<CorsSourceReachesCheckConfig>; module CorsSourceReachesCheckFlow = TaintTracking::Global<CorsSourceReachesCheckConfig>;
private module CorsOriginConfig implements DataFlow::ConfigSig { private module CorsOriginConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(MethodAccess corsHeader, MethodAccess allowCredentialsHeader | exists(MethodAccess corsHeader, MethodAccess allowCredentialsHeader |

View File

@@ -22,7 +22,7 @@ import RequestResponseFlow::PathGraph
/** Taint-tracking configuration tracing flow from get method request sources to output jsonp data. */ /** Taint-tracking configuration tracing flow from get method request sources to output jsonp data. */
module RequestResponseFlowConfig implements DataFlow::ConfigSig { module RequestResponseFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource and source instanceof ThreatModelFlowSource and
any(RequestGetMethod m).polyCalls*(source.getEnclosingCallable()) any(RequestGetMethod m).polyCalls*(source.getEnclosingCallable())
} }

View File

@@ -77,16 +77,26 @@ class JsonpBuilderExpr extends AddExpr {
Expr getJsonExpr() { result = this.getLeftOperand().(AddExpr).getRightOperand() } Expr getJsonExpr() { result = this.getLeftOperand().(AddExpr).getRightOperand() }
} }
/** A data flow configuration tracing flow from remote sources to jsonp function name. */ /** A data flow configuration tracing flow from threat model sources to jsonp function name. */
module RemoteFlowConfig implements DataFlow::ConfigSig { module ThreatModelFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(JsonpBuilderExpr jhe | jhe.getFunctionName() = sink.asExpr()) exists(JsonpBuilderExpr jhe | jhe.getFunctionName() = sink.asExpr())
} }
} }
module RemoteFlow = DataFlow::Global<RemoteFlowConfig>; /**
* DEPRECATED: Use `ThreatModelFlowConfig` instead.
*/
deprecated module RemoteFlowConfig = ThreatModelFlowConfig;
module ThreatModelFlow = DataFlow::Global<ThreatModelFlowConfig>;
/**
* DEPRECATED: Use `ThreatModelFlow` instead.
*/
deprecated module RemoteFlow = ThreatModelFlow;
/** A data flow configuration tracing flow from json data into the argument `json` of JSONP-like string `someFunctionName + "(" + json + ")"`. */ /** A data flow configuration tracing flow from json data into the argument `json` of JSONP-like string `someFunctionName + "(" + json + ")"`. */
module JsonDataFlowConfig implements DataFlow::ConfigSig { module JsonDataFlowConfig implements DataFlow::ConfigSig {
@@ -105,7 +115,7 @@ module JsonpInjectionFlowConfig implements DataFlow::ConfigSig {
exists(JsonpBuilderExpr jhe | exists(JsonpBuilderExpr jhe |
jhe = src.asExpr() and jhe = src.asExpr() and
JsonDataFlow::flowTo(DataFlow::exprNode(jhe.getJsonExpr())) and JsonDataFlow::flowTo(DataFlow::exprNode(jhe.getJsonExpr())) and
RemoteFlow::flowTo(DataFlow::exprNode(jhe.getFunctionName())) ThreatModelFlow::flowTo(DataFlow::exprNode(jhe.getFunctionName()))
) )
} }

View File

@@ -17,7 +17,7 @@ import ThreadResourceAbuseFlow::PathGraph
/** Taint configuration of uncontrolled thread resource consumption. */ /** Taint configuration of uncontrolled thread resource consumption. */
module ThreadResourceAbuseConfig implements DataFlow::ConfigSig { module ThreadResourceAbuseConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof PauseThreadSink } predicate isSink(DataFlow::Node sink) { sink instanceof PauseThreadSink }

View File

@@ -32,7 +32,7 @@ private predicate equalsSanitizer(Guard g, Expr e, boolean branch) {
} }
module UnsafeReflectionConfig implements DataFlow::ConfigSig { module UnsafeReflectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof UnsafeReflectionSink } predicate isSink(DataFlow::Node sink) { sink instanceof UnsafeReflectionSink }

View File

@@ -21,7 +21,7 @@ import UnsafeUrlForwardFlow::PathGraph
module UnsafeUrlForwardFlowConfig implements DataFlow::ConfigSig { module UnsafeUrlForwardFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource and source instanceof ThreatModelFlowSource and
not exists(MethodAccess ma, Method m | ma.getMethod() = m | not exists(MethodAccess ma, Method m | ma.getMethod() = m |
( (
m instanceof HttpServletRequestGetRequestUriMethod or m instanceof HttpServletRequestGetRequestUriMethod or

View File

@@ -65,9 +65,9 @@ class UncaughtServletExceptionSink extends DataFlow::ExprNode {
} }
} }
/** Taint configuration of uncaught exceptions caused by user provided data from `RemoteFlowSource` */ /** Taint configuration of uncaught exceptions caused by user provided data from `ThreatModelFlowSource` */
module UncaughtServletExceptionConfig implements DataFlow::ConfigSig { module UncaughtServletExceptionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof UncaughtServletExceptionSink } predicate isSink(DataFlow::Node sink) { sink instanceof UncaughtServletExceptionSink }
} }

View File

@@ -26,7 +26,7 @@ private predicate startsWithSanitizer(Guard g, Expr e, boolean branch) {
} }
module SpringUrlRedirectFlowConfig implements DataFlow::ConfigSig { module SpringUrlRedirectFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof SpringUrlRedirectSink } predicate isSink(DataFlow::Node sink) { sink instanceof SpringUrlRedirectSink }

View File

@@ -20,7 +20,7 @@ import XQueryInjectionFlow::PathGraph
* A taint-tracking configuration tracing flow from remote sources, through an XQuery parser, to its eventual execution. * A taint-tracking configuration tracing flow from remote sources, through an XQuery parser, to its eventual execution.
*/ */
module XQueryInjectionConfig implements DataFlow::ConfigSig { module XQueryInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
sink.asExpr() = any(XQueryPreparedExecuteCall xpec).getPreparedExpression() or sink.asExpr() = any(XQueryPreparedExecuteCall xpec).getPreparedExpression() or

View File

@@ -24,7 +24,7 @@ import NfeLocalDoSFlow::PathGraph
*/ */
module NfeLocalDoSConfig implements DataFlow::ConfigSig { module NfeLocalDoSConfig implements DataFlow::ConfigSig {
/** Holds if source is a remote flow source */ /** Holds if source is a remote flow source */
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
/** Holds if NFE is thrown but not caught */ /** Holds if NFE is thrown but not caught */
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {

View File

@@ -9,7 +9,7 @@ class TestRemoteFlowSource extends RemoteFlowSource {
} }
module TaintFlowConfig implements DataFlow::ConfigSig { module TaintFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node n) { n instanceof RemoteFlowSource } predicate isSource(DataFlow::Node n) { n instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node n) { predicate isSink(DataFlow::Node n) {
exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument()) exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument())

View File

@@ -7,7 +7,7 @@ module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { predicate isSource(DataFlow::Node node) {
DefaultFlowConfig::isSource(node) DefaultFlowConfig::isSource(node)
or or
node instanceof RemoteFlowSource node instanceof ThreatModelFlowSource
} }
predicate isSink = DefaultFlowConfig::isSink/1; predicate isSink = DefaultFlowConfig::isSink/1;

View File

@@ -3,7 +3,7 @@ import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest import TestUtilities.InlineFlowTest
module ProviderTaintFlowConfig implements DataFlow::ConfigSig { module ProviderTaintFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node n) { n instanceof RemoteFlowSource } predicate isSource(DataFlow::Node n) { n instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node n) { DefaultFlowConfig::isSink(n) } predicate isSink(DataFlow::Node n) { DefaultFlowConfig::isSink(n) }

View File

@@ -4,7 +4,7 @@ import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest import TestUtilities.InlineFlowTest
module Config implements DataFlow::ConfigSig { module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
sink.asExpr().(Argument).getCall().getCallee().hasName("sink") sink.asExpr().(Argument).getCall().getCallee().hasName("sink")

View File

@@ -5,7 +5,7 @@ import semmle.code.java.dataflow.FlowSources
module SliceValueFlowConfig implements DataFlow::ConfigSig { module SliceValueFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { predicate isSource(DataFlow::Node source) {
DefaultFlowConfig::isSource(source) or source instanceof RemoteFlowSource DefaultFlowConfig::isSource(source) or source instanceof ThreatModelFlowSource
} }
predicate isSink = DefaultFlowConfig::isSink/1; predicate isSink = DefaultFlowConfig::isSink/1;

View File

@@ -3,7 +3,7 @@ import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest import TestUtilities.InlineFlowTest
module SourceValueFlowConfig implements DataFlow::ConfigSig { module SourceValueFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { DefaultFlowConfig::isSink(sink) } predicate isSink(DataFlow::Node sink) { DefaultFlowConfig::isSink(sink) }

View File

@@ -9,7 +9,7 @@ module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node n) { predicate isSource(DataFlow::Node n) {
n.asExpr().(MethodAccess).getMethod().hasName("taint") n.asExpr().(MethodAccess).getMethod().hasName("taint")
or or
n instanceof RemoteFlowSource n instanceof ThreatModelFlowSource
} }
predicate isSink(DataFlow::Node n) { predicate isSink(DataFlow::Node n) {

View File

@@ -3,7 +3,7 @@ import semmle.code.java.dataflow.FlowSources
import semmle.code.java.dataflow.TaintTracking import semmle.code.java.dataflow.TaintTracking
module Config implements DataFlow::ConfigSig { module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src instanceof RemoteFlowSource } predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(MethodAccess ma | exists(MethodAccess ma |

View File

@@ -3,7 +3,7 @@ import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineExpectationsTest import TestUtilities.InlineExpectationsTest
module TestConfig implements DataFlow::ConfigSig { module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
exists(MethodAccess call | exists(MethodAccess call |

View File

@@ -7,7 +7,7 @@ module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { predicate isSource(DataFlow::Node node) {
DefaultFlowConfig::isSource(node) DefaultFlowConfig::isSource(node)
or or
node instanceof RemoteFlowSource node instanceof ThreatModelFlowSource
} }
predicate isSink = DefaultFlowConfig::isSink/1; predicate isSink = DefaultFlowConfig::isSink/1;

View File

@@ -4,7 +4,7 @@ import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest import TestUtilities.InlineFlowTest
module Config implements DataFlow::ConfigSig { module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } predicate isSource(DataFlow::Node node) { node instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node node) { predicate isSink(DataFlow::Node node) {
exists(MethodAccess ma | ma.getMethod().hasName("sink") | node.asExpr() = ma.getAnArgument()) exists(MethodAccess ma | ma.getMethod().hasName("sink") | node.asExpr() = ma.getAnArgument())

View File

@@ -7,7 +7,7 @@ module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node n) { predicate isSource(DataFlow::Node n) {
n.asExpr().(MethodAccess).getMethod().hasName("taint") n.asExpr().(MethodAccess).getMethod().hasName("taint")
or or
n instanceof RemoteFlowSource n instanceof ThreatModelFlowSource
} }
predicate isSink(DataFlow::Node n) { predicate isSink(DataFlow::Node n) {

View File

@@ -3,7 +3,7 @@ import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest import TestUtilities.InlineFlowTest
module ValueFlowConfig implements DataFlow::ConfigSig { module ValueFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
predicate isSink(DataFlow::Node sink) { predicate isSink(DataFlow::Node sink) {
sink.asExpr().(Argument).getCall().getCallee().hasName("sink") sink.asExpr().(Argument).getCall().getCallee().hasName("sink")