File tree Expand file tree Collapse file tree 5 files changed +27
-0
lines changed
ruby/ql/lib/codeql/ruby/security Expand file tree Collapse file tree 5 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ private import codeql.ruby.Concepts
4
4
private import codeql.ruby.Frameworks
5
5
private import codeql.ruby.dataflow.RemoteFlowSources
6
6
private import codeql.ruby.dataflow.BarrierGuards
7
+ private import codeql.ruby.frameworks.data.internal.ApiGraphModels
7
8
8
9
/**
9
10
* Provides default sources, sinks and sanitizers for detecting
@@ -156,4 +157,8 @@ module CodeInjection {
156
157
157
158
override FlowState:: State getAState ( ) { result instanceof FlowState:: Full }
158
159
}
160
+
161
+ private class ExternalCodeInjectionSink extends Sink {
162
+ ExternalCodeInjectionSink ( ) { this = ModelOutput:: getASinkNode ( "code-injection" ) .asSink ( ) }
163
+ }
159
164
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ private import codeql.ruby.dataflow.RemoteFlowSources
9
9
private import codeql.ruby.Concepts
10
10
private import codeql.ruby.Frameworks
11
11
private import codeql.ruby.ApiGraphs
12
+ private import codeql.ruby.frameworks.data.internal.ApiGraphModels
12
13
13
14
module CommandInjection {
14
15
/**
@@ -52,4 +53,10 @@ module CommandInjection {
52
53
this .( DataFlow:: CallNode ) .getMethodName ( ) = "shellescape"
53
54
}
54
55
}
56
+
57
+ private class ExternalCommandInjectionSink extends Sink {
58
+ ExternalCommandInjectionSink ( ) {
59
+ this = ModelOutput:: getASinkNode ( "command-injection" ) .asSink ( )
60
+ }
61
+ }
55
62
}
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import codeql.ruby.DataFlow
8
8
import codeql.ruby.TaintTracking
9
9
import codeql.ruby.dataflow.RemoteFlowSources
10
10
import codeql.ruby.frameworks.Core
11
+ private import codeql.ruby.frameworks.data.internal.ApiGraphModels
11
12
12
13
/**
13
14
* A data flow source for user input used in log entries.
@@ -50,6 +51,10 @@ class LoggingSink extends Sink {
50
51
LoggingSink ( ) { this = any ( Logging logging ) .getAnInput ( ) }
51
52
}
52
53
54
+ private class ExternalLogInjectionSink extends Sink {
55
+ ExternalLogInjectionSink ( ) { this = ModelOutput:: getASinkNode ( "log-injection" ) .asSink ( ) }
56
+ }
57
+
53
58
/**
54
59
* A call to `String#replace` that replaces `\n` is considered to sanitize the replaced string (reduce false positive).
55
60
*/
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ private import codeql.ruby.Concepts
11
11
private import codeql.ruby.DataFlow
12
12
private import codeql.ruby.dataflow.BarrierGuards
13
13
private import codeql.ruby.dataflow.RemoteFlowSources
14
+ private import codeql.ruby.frameworks.data.internal.ApiGraphModels
14
15
15
16
module PathInjection {
16
17
/**
@@ -52,4 +53,8 @@ module PathInjection {
52
53
class StringConstArrayInclusionCallAsSanitizer extends Sanitizer ,
53
54
StringConstArrayInclusionCallBarrier
54
55
{ }
56
+
57
+ private class ExternalPathInjectionSink extends Sink {
58
+ ExternalPathInjectionSink ( ) { this = ModelOutput:: getASinkNode ( "path-injection" ) .asSink ( ) }
59
+ }
55
60
}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ private import codeql.ruby.dataflow.RemoteFlowSources
11
11
private import codeql.ruby.dataflow.BarrierGuards
12
12
private import codeql.ruby.dataflow.Sanitizers
13
13
private import codeql.ruby.frameworks.ActionController
14
+ private import codeql.ruby.frameworks.data.internal.ApiGraphModels
14
15
15
16
/**
16
17
* Provides default sources, sinks and sanitizers for detecting
@@ -73,6 +74,10 @@ module UrlRedirect {
73
74
}
74
75
}
75
76
77
+ private class ExternalUrlRedirectSink extends Sink {
78
+ ExternalUrlRedirectSink ( ) { this = ModelOutput:: getASinkNode ( "url-redirect" ) .asSink ( ) }
79
+ }
80
+
76
81
/**
77
82
* A comparison with a constant string, considered as a sanitizer-guard.
78
83
*/
You can’t perform that action at this time.
0 commit comments