Skip to content

Commit df91735

Browse files
committed
Ruby: configsig rb/sensitive-get-query
1 parent 593d9a4 commit df91735

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* Provides a taint-tracking configuration for detecting flow of query string
33
* data to sensitive actions in GET query request handlers.
44
*
5-
* Note, for performance reasons: only import this file if `Configuration` is
6-
* needed, otherwise `SensitiveGetQueryCustomizations` should be imported
7-
* instead.
5+
* Note, for performance reasons: only import this file if
6+
* `SensitiveGetQueryFlow` is needed, otherwise
7+
* `SensitiveGetQueryCustomizations` should be imported instead.
88
*/
99

1010
private import ruby
@@ -13,19 +13,34 @@ private import codeql.ruby.TaintTracking
1313
/**
1414
* Provides a taint-tracking configuration for detecting flow of query string
1515
* data to sensitive actions in GET query request handlers.
16+
* DEPRECATED: Use `SensitiveGetQueryFlow`
1617
*/
17-
module SensitiveGetQuery {
18+
deprecated module SensitiveGetQuery {
1819
import SensitiveGetQueryCustomizations::SensitiveGetQuery
1920

2021
/**
2122
* A taint-tracking configuration for reasoning about use of sensitive data
2223
* from a GET request query string.
2324
*/
24-
class Configuration extends TaintTracking::Configuration {
25+
deprecated class Configuration extends TaintTracking::Configuration {
2526
Configuration() { this = "SensitiveGetQuery" }
2627

2728
override predicate isSource(DataFlow::Node source) { source instanceof Source }
2829

2930
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
3031
}
3132
}
33+
34+
private module SensitiveGetQueryConfig implements DataFlow::ConfigSig {
35+
import SensitiveGetQueryCustomizations::SensitiveGetQuery
36+
37+
predicate isSource(DataFlow::Node source) { source instanceof Source }
38+
39+
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
40+
}
41+
42+
/**
43+
* Taint-tracking for reasoning about use of sensitive data from a
44+
* GET request query string.
45+
*/
46+
module SensitiveGetQueryFlow = TaintTracking::Global<SensitiveGetQueryConfig>;

ruby/ql/src/queries/security/cwe-598/SensitiveGetQuery.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414
import ruby
1515
import codeql.ruby.security.SensitiveGetQueryQuery
16+
import codeql.ruby.security.SensitiveGetQueryCustomizations::SensitiveGetQuery
1617
import codeql.ruby.security.SensitiveActions
1718

18-
from DataFlow::Node source, DataFlow::Node sink, SensitiveGetQuery::Configuration config
19-
where config.hasFlow(source, sink)
20-
select source, "$@ for GET requests uses query parameter as sensitive data.",
21-
source.(SensitiveGetQuery::Source).getHandler(), "Route handler"
19+
from Source source, DataFlow::Node sink
20+
where SensitiveGetQueryFlow::flow(source, sink)
21+
select source, "$@ for GET requests uses query parameter as sensitive data.", source.getHandler(),
22+
"Route handler"

0 commit comments

Comments
 (0)