@@ -2,11 +2,11 @@ class FooController < ActionController::Base
22 def some_request_handler
33 # A string tainted by user input is used directly as DN
44 # (i.e a remote flow source)
5- dc = params[:dc]
5+ dc = params[:dc] # $ Source
66
77 # A string tainted by user input is used directly as search filter or attribute
88 # (i.e a remote flow source)
9- name = params[:user_name]
9+ name = params[:user_name] # $ Source
1010
1111 # LDAP Connection
1212 ldap = Net::LDAP.new(
@@ -22,20 +22,20 @@ def some_request_handler
2222
2323 # BAD: user input is used as DN
2424 # where dc is unsanitized
25- ldap.search(base: "ou=people,dc=#{dc},dc=com", filter: "cn=George", attributes: [""])
25+ ldap.search(base: "ou=people,dc=#{dc},dc=com", filter: "cn=George", attributes: [""]) # $ Alert
2626
2727 # BAD: user input is used as search filter
2828 # where name is unsanitized
29- ldap.search(base: "ou=people,dc=example,dc=com", filter: "cn=#{name}", attributes: [""])
29+ ldap.search(base: "ou=people,dc=example,dc=com", filter: "cn=#{name}", attributes: [""]) # $ Alert
3030
3131 # BAD: user input is used as attribute
3232 # where name is unsanitized
33- ldap.search(base: "ou=people,dc=example,dc=com", filter: "cn=George", attributes: [name])
33+ ldap.search(base: "ou=people,dc=example,dc=com", filter: "cn=George", attributes: [name]) # $ Alert
3434
3535 # BAD: user input is used as search filter
3636 # where name is unsanitized
3737 filter = Net::LDAP::Filter.eq('cn', name)
38- ldap.search(base: "ou=people,dc=example,dc=com", filter: filter, attributes: [""])
38+ ldap.search(base: "ou=people,dc=example,dc=com", filter: filter, attributes: [""]) # $ Alert
3939
4040 # GOOD: user input is not used in the LDAP query
4141 result = ldap.search(base: "ou=people,dc=example,dc=com", filter: "cn=George", attributes: [""])
@@ -63,4 +63,4 @@ def safe_paths
6363 end
6464 result = ldap.search(base: "ou=people,dc=example,dc=com", filter: "cn=#{name}", attributes: [""])
6565 end
66- end
66+ end
0 commit comments