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 77private import ruby
88private import codeql.ruby.ApiGraphs
99private import codeql.ruby.frameworks.core.Gem:: Gem as Gem
10+ private import codeql.ruby.security.XSS:: ReflectedXss as ReflectedXss
1011private import codeql.ruby.typetracking.TypeTracking
1112
1213/**
@@ -34,7 +35,11 @@ module UnsafeHtmlConstruction {
3435 abstract string getSinkType ( ) ;
3536 }
3637
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 { }
3843
3944 /** Gets a node that eventually ends up in the XSS `sink`. */
4045 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 {
2323
2424 override predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
2525
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 }
3027
3128 // override to require the path doesn't have unmatched return steps
3229 override DataFlow:: FlowFeature getAFeature ( ) {
@@ -39,10 +36,7 @@ private module UnsafeHtmlConstructionConfig implements DataFlow::ConfigSig {
3936
4037 predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
4138
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 }
4640
4741 // override to require the path doesn't have unmatched return steps
4842 DataFlow:: FlowFeature getAFeature ( ) { result instanceof DataFlow:: FeatureHasSourceCallContext }
You can’t perform that action at this time.
0 commit comments