Skip to content

Commit

Permalink
Ruby: configsig rb/improper-ldap-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrford committed Sep 21, 2023
1 parent e45edca commit 9d421ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 15 additions & 1 deletion ruby/ql/lib/codeql/ruby/security/ImproperLdapAuthQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ private import ImproperLdapAuthCustomizations::ImproperLdapAuth

/**
* A taint-tracking configuration for detecting improper LDAP authentication vulnerabilities.
* DEPRECATED: Use `ImproperLdapAuthFlow` instead
*/
class Configuration extends TaintTracking::Configuration {
deprecated class Configuration extends TaintTracking::Configuration {
Configuration() { this = "ImproperLdapAuth" }

override predicate isSource(DataFlow::Node source) { source instanceof Source }
Expand All @@ -19,3 +20,16 @@ class Configuration extends TaintTracking::Configuration {

override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
}

private module ImproperLdapAuthConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof Source }

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

predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
}

/**
* Taint-tracking for detecting improper LDAP authentication vulnerabilities.
*/
module ImproperLdapAuthFlow = TaintTracking::Global<ImproperLdapAuthConfig>;
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import codeql.ruby.DataFlow
import codeql.ruby.security.ImproperLdapAuthQuery
import codeql.ruby.Concepts
import DataFlow::PathGraph
import ImproperLdapAuthFlow::PathGraph

from Configuration config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
from ImproperLdapAuthFlow::PathNode source, ImproperLdapAuthFlow::PathNode sink
where ImproperLdapAuthFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "This LDAP authencation depends on a $@.", source.getNode(),
"user-provided value"

0 comments on commit 9d421ff

Please sign in to comment.