Skip to content

Commit 030aae5

Browse files
committed
Ruby: configsig rb/stack-trace-exposure
1 parent bf1cb33 commit 030aae5

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ private import StackTraceExposureCustomizations::StackTraceExposure
1313

1414
/**
1515
* A taint-tracking configuration for detecting "stack trace exposure" vulnerabilities.
16+
* DEPRECATED: Use `StackTraceExposureFlow`
1617
*/
17-
class Configuration extends TaintTracking::Configuration {
18+
deprecated class Configuration extends TaintTracking::Configuration {
1819
Configuration() { this = "StackTraceExposure" }
1920

2021
override predicate isSource(DataFlow::Node source) { source instanceof Source }
@@ -23,3 +24,16 @@ class Configuration extends TaintTracking::Configuration {
2324

2425
override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
2526
}
27+
28+
private module StackTraceExposureConfig implements DataFlow::ConfigSig {
29+
predicate isSource(DataFlow::Node source) { source instanceof Source }
30+
31+
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
32+
33+
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
34+
}
35+
36+
/**
37+
* Taint-tracking for detecting "stack trace exposure" vulnerabilities.
38+
*/
39+
module StackTraceExposureFlow = TaintTracking::Global<StackTraceExposureConfig>;

ruby/ql/src/queries/security/cwe-209/StackTraceExposure.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
import codeql.ruby.DataFlow
1717
import codeql.ruby.security.StackTraceExposureQuery
18-
import DataFlow::PathGraph
18+
import StackTraceExposureFlow::PathGraph
1919

20-
from Configuration config, DataFlow::PathNode source, DataFlow::PathNode sink
21-
where config.hasFlowPath(source, sink)
20+
from StackTraceExposureFlow::PathNode source, StackTraceExposureFlow::PathNode sink
21+
where StackTraceExposureFlow::flowPath(source, sink)
2222
select sink.getNode(), source, sink, "$@ can be exposed to an external user.", source.getNode(),
2323
"Error information"

0 commit comments

Comments
 (0)