File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
ruby/ql/lib/codeql/ruby/security Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 7
7
private import ruby
8
8
private import codeql.ruby.ApiGraphs
9
9
private import codeql.ruby.frameworks.core.Gem:: Gem as Gem
10
+ private import codeql.ruby.security.XSS:: ReflectedXss as ReflectedXss
10
11
private import codeql.ruby.typetracking.TypeTracking
11
12
12
13
/**
@@ -34,7 +35,11 @@ module UnsafeHtmlConstruction {
34
35
abstract string getSinkType ( ) ;
35
36
}
36
37
37
- private import codeql.ruby.security.XSS:: ReflectedXss as ReflectedXss
38
+ /** A sanitizer for HTML constructed from library input vulnerabilities. */
39
+ abstract class Sanitizer extends DataFlow:: Node { }
40
+
41
+ // inherit all the sanitizers from ReflectedXss
42
+ class ReflectedXssSanitizers extends Sanitizer instanceof ReflectedXss:: Sanitizer { }
38
43
39
44
/** Gets a node that eventually ends up in the XSS `sink`. */
40
45
private DataFlow:: Node getANodeThatEndsInXssSink ( ReflectedXss:: Sink sink ) {
Original file line number Diff line number Diff line change @@ -23,10 +23,7 @@ deprecated class Configuration extends TaintTracking::Configuration {
23
23
24
24
override predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
25
25
26
- override predicate isSanitizer ( DataFlow:: Node node ) {
27
- node instanceof StringConstCompareBarrier or
28
- node instanceof StringConstArrayInclusionCallBarrier
29
- }
26
+ override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof Sanitizer }
30
27
31
28
// override to require the path doesn't have unmatched return steps
32
29
override DataFlow:: FlowFeature getAFeature ( ) {
@@ -39,10 +36,7 @@ private module UnsafeHtmlConstructionConfig implements DataFlow::ConfigSig {
39
36
40
37
predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
41
38
42
- predicate isBarrier ( DataFlow:: Node node ) {
43
- node instanceof StringConstCompareBarrier or
44
- node instanceof StringConstArrayInclusionCallBarrier
45
- }
39
+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
46
40
47
41
// override to require the path doesn't have unmatched return steps
48
42
DataFlow:: FlowFeature getAFeature ( ) { result instanceof DataFlow:: FeatureHasSourceCallContext }
You can’t perform that action at this time.
0 commit comments