Skip to content

Commit

Permalink
Merge pull request #17190 from github/cklin/diff-informed-java-queries
Browse files Browse the repository at this point in the history
Java: add support for alert location restrictions
  • Loading branch information
cklin authored Sep 23, 2024
2 parents e7bc71f + 75ec8ce commit 1cd8af5
Show file tree
Hide file tree
Showing 70 changed files with 299 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
2 changes: 2 additions & 0 deletions go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl1.qll
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
2 changes: 2 additions & 0 deletions go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl2.qll
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }

predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }

predicate observeDiffInformedIncrementalMode() { none() }
}

deprecated private import Impl<Config> as I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module IntentRedirectionConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(IntentRedirectionAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks the flow of tainted Intents being used to start Android components. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module ExternallyControlledFormatStringConfig implements DataFlow::ConfigSig {
predicate isBarrier(DataFlow::Node node) {
node.getType() instanceof NumericType or node.getType() instanceof BooleanType
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module FragmentInjectionTaintConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) {
any(FragmentInjectionAdditionalTaintStep c).step(n1, n2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module GroovyInjectionConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node fromNode, DataFlow::Node toNode) {
any(GroovyInjectionAdditionalTaintStep c).step(fromNode, toNode)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ module ImplicitPendingIntentStartConfig implements DataFlow::StateConfigSig {
node.getType().(Array).getElementType() instanceof TypeIntent and
c instanceof DataFlow::ArrayContent
}

predicate observeDiffInformedIncrementalMode() { any() }
}

module ImplicitPendingIntentStartFlow =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ module BeanValidationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }

predicate isSink(DataFlow::Node sink) { sink instanceof BeanValidationSink }

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow from user input to the argument of a method that builds constraint error messages. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module InsecureLdapUrlConfig implements DataFlow::ConfigSig {
succ.asExpr() = ma.getQualifier()
)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

module InsecureLdapUrlFlow = TaintTracking::Global<InsecureLdapUrlConfig>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ module InsecureRandomnessConfig implements DataFlow::ConfigSig {
n2.asExpr() = c
)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module KeySizeConfig implements DataFlow::StateConfigSig {
predicate isSink(DataFlow::Node sink, KeySizeState state) {
sink.(InsufficientKeySizeSink).hasState(state)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks key sizes used in cryptographic algorithms. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module IntentUriPermissionManipulationConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(IntentUriPermissionManipulationAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/JexlInjectionQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ module JexlInjectionConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(JexlInjectionAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/JndiInjectionQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module JndiInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(JndiInjectionAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow of unvalidated user input that is used in JNDI lookup */
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/LdapInjectionQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module LdapInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
any(LdapInjectionAdditionalTaintStep a).step(pred, succ)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow from remote sources to LDAP injection vulnerabilities. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module MissingJwtSignatureCheckConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(JwtParserWithInsecureParseAdditionalFlowStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

module MissingJwtSignatureCheckFlow = DataFlow::Global<MissingJwtSignatureCheckConfig>;
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/MvelInjectionQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module MvelInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(MvelInjectionAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow of unsafe user input that is used to construct and evaluate a MVEL expression. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ module NumericCastFlowConfig implements DataFlow::ConfigSig {
}

predicate isBarrierIn(DataFlow::Node node) { isSource(node) }

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/OgnlInjectionQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module OgnlInjectionFlowConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(OgnlInjectionAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow of unvalidated user input that is used in OGNL EL evaluation. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module PartialPathTraversalFromRemoteConfig implements DataFlow::ConfigSig {
predicate isSink(DataFlow::Node node) {
any(PartialPathTraversalMethodCall ma).getQualifier() = node.asExpr()
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow of unsafe user input that is used to validate against path traversal, but is insufficient and remains vulnerable to Partial Path Traversal. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module RequestForgeryConfig implements DataFlow::ConfigSig {
predicate isBarrier(DataFlow::Node node) { node instanceof RequestForgerySanitizer }

predicate isBarrierIn(DataFlow::Node node) { isSource(node) }

predicate observeDiffInformedIncrementalMode() { any() }
}

module RequestForgeryFlow = TaintTracking::Global<RequestForgeryConfig>;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ module ResponseSplittingConfig implements DataFlow::ConfigSig {
)
)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/**
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/RsaWithoutOaepQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module RsaWithoutOaepConfig implements DataFlow::ConfigSig {
predicate isSink(DataFlow::Node sink) {
exists(CryptoAlgoSpec cr | sink.asExpr() = cr.getAlgoSpec())
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Flow for finding RSA ciphers initialized without using OAEP padding. */
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/security/SpelInjectionQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module SpelInjectionConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(SpelExpressionInjectionAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
}

/** Tracks flow of unsafe user input that is used to construct and evaluate a SpEL expression. */
Expand Down
Loading

0 comments on commit 1cd8af5

Please sign in to comment.