@@ -17,9 +17,11 @@ module SafeUrlFlow {
1717 import SafeUrlFlowCustomizations:: SafeUrlFlow
1818
1919 /**
20+ * DEPRECATED: Use `Flow` instead.
21+ *
2022 * A taint-tracking configuration for reasoning about safe URLs.
2123 */
22- class Configuration extends TaintTracking:: Configuration {
24+ deprecated class Configuration extends TaintTracking:: Configuration {
2325 Configuration ( ) { this = "SafeUrlFlow" }
2426
2527 override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -42,4 +44,28 @@ module SafeUrlFlow {
4244 node instanceof SanitizerEdge
4345 }
4446 }
47+
48+ private module Config implements DataFlow:: ConfigSig {
49+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
50+
51+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
52+
53+ predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
54+ // propagate to a URL when its host is assigned to
55+ exists ( Write w , Field f , SsaWithFields v | f .hasQualifiedName ( "net/url" , "URL" , "Host" ) |
56+ w .writesField ( v .getAUse ( ) , f , node1 ) and node2 = v .getAUse ( )
57+ )
58+ }
59+
60+ predicate isBarrierOut ( DataFlow:: Node node ) {
61+ // block propagation of this safe value when its host is overwritten
62+ exists ( Write w , Field f | f .hasQualifiedName ( "net/url" , "URL" , "Host" ) |
63+ w .writesField ( node .getASuccessor ( ) , f , _)
64+ )
65+ or
66+ node instanceof SanitizerEdge
67+ }
68+ }
69+
70+ module Flow = TaintTracking:: Global< Config > ;
4571}
0 commit comments