Skip to content

Commit ffd618d

Browse files
committed
Revert "Add "" and nil as sources"
This reverts commit 664c1eb.
1 parent 664c1eb commit ffd618d

File tree

4 files changed

+2
-65
lines changed

4 files changed

+2
-65
lines changed

ruby/ql/lib/codeql/ruby/security/ImproperLdapAuthCustomizations.qll

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,6 @@ module ImproperLdapAuth {
2727
*/
2828
private class RemoteFlowSourceAsSource extends Source, RemoteFlowSource { }
2929

30-
/**
31-
* A source of empty input, considered as a flow source.
32-
*/
33-
private class EmptySourceAsSource extends Source, EmptySource { }
34-
35-
class EmptySource extends DataFlow::Node {
36-
/** Gets a string that describes the type of this remote flow source. */
37-
EmptySource() {
38-
(
39-
this.getConstantValue().isStringlikeValue("")
40-
or
41-
this.(DataFlow::ExprNode).getConstantValue().isNil()
42-
)
43-
}
44-
}
45-
4630
/**
4731
* An LDAP query execution considered as a flow sink.
4832
*/
@@ -60,6 +44,5 @@ module ImproperLdapAuth {
6044
* sanitizer-guard.
6145
*/
6246
private class StringConstArrayInclusionCallAsSanitizer extends Sanitizer,
63-
StringConstArrayInclusionCallBarrier
64-
{ }
47+
StringConstArrayInclusionCallBarrier { }
6548
}

ruby/ql/src/experimental/ldap-improper-auth/ImproperLdapAuth.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ import DataFlow::PathGraph
1717
from Configuration config, DataFlow::PathNode source, DataFlow::PathNode sink
1818
where config.hasFlowPath(source, sink)
1919
select sink.getNode(), source, sink, "This LDAP authencation depends on a $@.", source.getNode(),
20-
"user-provided value or the password is empty"
20+
"user-provided value"

ruby/ql/test/query-tests/experimental/ImproperLdapAuth/ImproperLdapAuth.expected

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ edges
55
| ImproperLdapAuth.rb:24:5:24:8 | pass | ImproperLdapAuth.rb:31:24:31:27 | pass |
66
| ImproperLdapAuth.rb:24:12:24:17 | call to params | ImproperLdapAuth.rb:24:12:24:24 | ...[...] |
77
| ImproperLdapAuth.rb:24:12:24:24 | ...[...] | ImproperLdapAuth.rb:24:5:24:8 | pass |
8-
| ImproperLdapAuth.rb:37:5:37:8 | pass | ImproperLdapAuth.rb:47:23:47:26 | pass |
9-
| ImproperLdapAuth.rb:37:12:37:14 | nil | ImproperLdapAuth.rb:37:5:37:8 | pass |
10-
| ImproperLdapAuth.rb:55:5:55:8 | pass | ImproperLdapAuth.rb:62:24:62:27 | pass |
11-
| ImproperLdapAuth.rb:55:12:55:13 | "" | ImproperLdapAuth.rb:55:5:55:8 | pass |
128
nodes
139
| ImproperLdapAuth.rb:5:5:5:8 | pass | semmle.label | pass |
1410
| ImproperLdapAuth.rb:5:12:5:17 | call to params | semmle.label | call to params |
@@ -18,17 +14,7 @@ nodes
1814
| ImproperLdapAuth.rb:24:12:24:17 | call to params | semmle.label | call to params |
1915
| ImproperLdapAuth.rb:24:12:24:24 | ...[...] | semmle.label | ...[...] |
2016
| ImproperLdapAuth.rb:31:24:31:27 | pass | semmle.label | pass |
21-
| ImproperLdapAuth.rb:37:5:37:8 | pass | semmle.label | pass |
22-
| ImproperLdapAuth.rb:37:12:37:14 | nil | semmle.label | nil |
23-
| ImproperLdapAuth.rb:47:23:47:26 | pass | semmle.label | pass |
24-
| ImproperLdapAuth.rb:55:5:55:8 | pass | semmle.label | pass |
25-
| ImproperLdapAuth.rb:55:12:55:13 | "" | semmle.label | "" |
26-
| ImproperLdapAuth.rb:62:24:62:27 | pass | semmle.label | pass |
2717
subpaths
2818
#select
2919
| ImproperLdapAuth.rb:15:23:15:26 | pass | ImproperLdapAuth.rb:5:12:5:17 | call to params | ImproperLdapAuth.rb:15:23:15:26 | pass | This LDAP authencation depends on a $@. | ImproperLdapAuth.rb:5:12:5:17 | call to params | user-provided value |
3020
| ImproperLdapAuth.rb:31:24:31:27 | pass | ImproperLdapAuth.rb:24:12:24:17 | call to params | ImproperLdapAuth.rb:31:24:31:27 | pass | This LDAP authencation depends on a $@. | ImproperLdapAuth.rb:24:12:24:17 | call to params | user-provided value |
31-
| ImproperLdapAuth.rb:47:23:47:26 | pass | ImproperLdapAuth.rb:37:12:37:14 | nil | ImproperLdapAuth.rb:47:23:47:26 | pass | This LDAP authencation depends on a $@. | ImproperLdapAuth.rb:37:12:37:14 | nil | user-provided value |
32-
| ImproperLdapAuth.rb:47:23:47:26 | pass | ImproperLdapAuth.rb:47:23:47:26 | pass | ImproperLdapAuth.rb:47:23:47:26 | pass | This LDAP authencation depends on a $@. | ImproperLdapAuth.rb:47:23:47:26 | pass | user-provided value |
33-
| ImproperLdapAuth.rb:62:24:62:27 | pass | ImproperLdapAuth.rb:55:12:55:13 | "" | ImproperLdapAuth.rb:62:24:62:27 | pass | This LDAP authencation depends on a $@. | ImproperLdapAuth.rb:55:12:55:13 | "" | user-provided value |
34-
| ImproperLdapAuth.rb:62:24:62:27 | pass | ImproperLdapAuth.rb:62:24:62:27 | pass | ImproperLdapAuth.rb:62:24:62:27 | pass | This LDAP authencation depends on a $@. | ImproperLdapAuth.rb:62:24:62:27 | pass | user-provided value |

ruby/ql/test/query-tests/experimental/ImproperLdapAuth/ImproperLdapAuth.rb

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,6 @@ def some_request_handler
3131
ldap.auth "admin", pass
3232
ldap.bind
3333
end
34-
35-
def some_request_handler
36-
# An empty password is used
37-
pass = nil
38-
39-
# BAD: empty password
40-
ldap = Net::LDAP.new(
41-
host: 'ldap.example.com',
42-
port: 636,
43-
encryption: :simple_tls,
44-
auth: {
45-
method: :simple,
46-
username: 'uid=admin,dc=example,dc=com',
47-
password: pass
48-
}
49-
)
50-
ldap.bind
51-
end
52-
53-
def some_request_handler
54-
# An empty password is used
55-
pass = ""
56-
57-
# BAD: empty password
58-
ldap = Net::LDAP.new
59-
ldap.host = your_server_ip_address
60-
ldap.encryption(:method => :simple_tls)
61-
ldap.port = 639
62-
ldap.auth "admin", pass
63-
ldap.bind
64-
end
65-
6634
end
6735

6836
class BarController < ApplicationController

0 commit comments

Comments
 (0)