2
2
* Provides a taint-tracking configuration for reasoning about HTML
3
3
* constructed from library input vulnerabilities.
4
4
*
5
- * Note, for performance reasons: only import this file if `Configuration` is needed,
6
- * otherwise `UnsafeHtmlConstructionCustomizations` should be imported instead.
5
+ * Note, for performance reasons: only import this file if
6
+ * `UnsafeHtmlConstructionFlow` is needed, otherwise
7
+ * `UnsafeHtmlConstructionCustomizations` should be imported instead.
7
8
*/
8
9
9
10
import codeql.ruby.DataFlow
@@ -13,8 +14,9 @@ private import codeql.ruby.dataflow.BarrierGuards
13
14
14
15
/**
15
16
* A taint-tracking configuration for detecting unsafe HTML construction.
17
+ * DEPRECATED: Use `UnsafeHtmlConstructionFlow`
16
18
*/
17
- class Configuration extends TaintTracking:: Configuration {
19
+ deprecated class Configuration extends TaintTracking:: Configuration {
18
20
Configuration ( ) { this = "UnsafeHtmlConstruction" }
19
21
20
22
override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -31,3 +33,22 @@ class Configuration extends TaintTracking::Configuration {
31
33
result instanceof DataFlow:: FeatureHasSourceCallContext
32
34
}
33
35
}
36
+
37
+ private module UnsafeHtmlConstructionConfig implements DataFlow:: ConfigSig {
38
+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
39
+
40
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
41
+
42
+ predicate isBarrier ( DataFlow:: Node node ) {
43
+ node instanceof StringConstCompareBarrier or
44
+ node instanceof StringConstArrayInclusionCallBarrier
45
+ }
46
+
47
+ // override to require the path doesn't have unmatched return steps
48
+ DataFlow:: FlowFeature getAFeature ( ) { result instanceof DataFlow:: FeatureHasSourceCallContext }
49
+ }
50
+
51
+ /**
52
+ * Taint-tracking for detecting unsafe HTML construction.
53
+ */
54
+ module UnsafeHtmlConstructionFlow = TaintTracking:: Global< UnsafeHtmlConstructionConfig > ;
0 commit comments