@@ -47,16 +47,16 @@ signature module InputSig<LocationSig Location, DF::InputSig<Location> Lang> {
4747/**
4848 * Construct the modules for taint-tracking analyses.
4949 */
50- module TaintFlowMake <
50+ private module TaintFlowMakeCore <
5151 LocationSig Location, DF:: InputSig< Location > DataFlowLang,
5252 InputSig< Location , DataFlowLang > TaintTrackingLang>
5353{
54- private import TaintTrackingLang
55- private import DF:: DataFlowMake < Location , DataFlowLang > as DataFlow
56- private import MakeImpl< Location , DataFlowLang > as DataFlowInternal
57- private import MakeImplStage1< Location , DataFlowLang > as DataFlowInternalStage1
54+ import TaintTrackingLang
55+ import DF:: DataFlowMakeCore < Location , DataFlowLang > as DataFlow
56+ import MakeImpl< Location , DataFlowLang > as DataFlowInternal
57+ import MakeImplStage1< Location , DataFlowLang > as DataFlowInternalStage1
5858
59- private module AddTaintDefaults< DataFlowInternal:: FullStateConfigSig Config> implements
59+ module AddTaintDefaults< DataFlowInternal:: FullStateConfigSig Config> implements
6060 DataFlowInternal:: FullStateConfigSig
6161 {
6262 import Config
@@ -85,7 +85,7 @@ module TaintFlowMake<
8585
8686 signature int speculationLimitSig ( ) ;
8787
88- private module AddSpeculativeTaintSteps<
88+ module AddSpeculativeTaintSteps<
8989 DataFlowInternal:: FullStateConfigSig Config, speculationLimitSig / 0 speculationLimit> implements
9090 DataFlowInternal:: FullStateConfigSig
9191 {
@@ -153,6 +153,13 @@ module TaintFlowMake<
153153 state1 .getState ( ) = state2 .getState ( )
154154 }
155155 }
156+ }
157+
158+ module TaintFlowMake<
159+ LocationSig Location, DF:: InputSig< Location > DataFlowLang,
160+ InputSig< Location , DataFlowLang > TaintTrackingLang>
161+ {
162+ private import TaintFlowMakeCore< Location , DataFlowLang , TaintTrackingLang >
156163
157164 /**
158165 * Constructs a global taint tracking computation.
@@ -288,8 +295,162 @@ module TaintFlowMake<
288295
289296 import Stage1:: PartialFlow
290297
298+ private module Flow = DataFlowInternal:: OverlayImpl< C , Stage1:: Stage1WithState > ;
299+
300+ import Flow
301+ }
302+ }
303+
304+ module TaintFlowMakeOverlay<
305+ LocationSig Location, DF:: InputSig< Location > DataFlowLang,
306+ InputSig< Location , DataFlowLang > TaintTrackingLang>
307+ {
308+ private import TaintFlowMakeCore< Location , DataFlowLang , TaintTrackingLang >
309+
310+ /**
311+ * Constructs a global taint tracking computation.
312+ */
313+ module Global< DataFlow:: ConfigSig Config> implements DataFlow:: GlobalFlowSig {
314+ private module Config0 implements DataFlowInternal:: FullStateConfigSig {
315+ import DataFlowInternal:: DefaultState< Config >
316+ import Config
317+
318+ predicate isAdditionalFlowStep (
319+ DataFlowLang:: Node node1 , DataFlowLang:: Node node2 , string model
320+ ) {
321+ Config:: isAdditionalFlowStep ( node1 , node2 ) and model = "Config"
322+ }
323+
324+ predicate observeOverlayInformedIncrementalMode ( ) {
325+ not Config:: observeDiffInformedIncrementalMode ( )
326+ }
327+ }
328+
329+ private module C implements DataFlowInternal:: FullStateConfigSig {
330+ import AddTaintDefaults< Config0 >
331+ }
332+
333+ private module Stage1 = DataFlowInternalStage1:: ImplStage1< C > ;
334+
335+ import Stage1:: PartialFlow
336+
337+ private module Flow = DataFlowInternal:: OverlayImpl< C , Stage1:: Stage1NoState > ;
338+
339+ import Flow
340+ }
341+
342+ /**
343+ * Constructs a global taint tracking computation using flow state.
344+ */
345+ module GlobalWithState< DataFlow:: StateConfigSig Config> implements DataFlow:: GlobalFlowSig {
346+ private module Config0 implements DataFlowInternal:: FullStateConfigSig {
347+ import Config
348+
349+ predicate isAdditionalFlowStep (
350+ DataFlowLang:: Node node1 , DataFlowLang:: Node node2 , string model
351+ ) {
352+ Config:: isAdditionalFlowStep ( node1 , node2 ) and model = "Config"
353+ }
354+
355+ predicate isAdditionalFlowStep (
356+ DataFlowLang:: Node node1 , FlowState state1 , DataFlowLang:: Node node2 , FlowState state2 ,
357+ string model
358+ ) {
359+ Config:: isAdditionalFlowStep ( node1 , state1 , node2 , state2 ) and model = "Config"
360+ }
361+
362+ predicate observeOverlayInformedIncrementalMode ( ) {
363+ not Config:: observeDiffInformedIncrementalMode ( )
364+ }
365+ }
366+
367+ private module C implements DataFlowInternal:: FullStateConfigSig {
368+ import AddTaintDefaults< Config0 >
369+ }
370+
371+ private module Stage1 = DataFlowInternalStage1:: ImplStage1< C > ;
372+
373+ import Stage1:: PartialFlow
374+
375+ private module Flow = DataFlowInternal:: OverlayImpl< C , Stage1:: Stage1WithState > ;
376+
377+ import Flow
378+ }
379+
380+ /**
381+ * Constructs a global taint tracking computation that also allows a given
382+ * maximum number of speculative taint steps.
383+ */
384+ module SpeculativeGlobal< DataFlow:: ConfigSig Config, speculationLimitSig / 0 speculationLimit>
385+ implements DataFlow:: GlobalFlowSig
386+ {
387+ private module Config0 implements DataFlowInternal:: FullStateConfigSig {
388+ import DataFlowInternal:: DefaultState< Config >
389+ import Config
390+
391+ predicate isAdditionalFlowStep (
392+ DataFlowLang:: Node node1 , DataFlowLang:: Node node2 , string model
393+ ) {
394+ Config:: isAdditionalFlowStep ( node1 , node2 ) and model = "Config"
395+ }
396+
397+ predicate observeOverlayInformedIncrementalMode ( ) {
398+ not Config:: observeDiffInformedIncrementalMode ( )
399+ }
400+ }
401+
402+ private module C implements DataFlowInternal:: FullStateConfigSig {
403+ import AddTaintDefaults< AddSpeculativeTaintSteps< Config0 , speculationLimit / 0 > >
404+ }
405+
406+ private module Stage1 = DataFlowInternalStage1:: ImplStage1< C > ;
407+
408+ import Stage1:: PartialFlow
409+
291410 private module Flow = DataFlowInternal:: Impl< C , Stage1:: Stage1WithState > ;
292411
293412 import Flow
294413 }
414+
415+ /**
416+ * Constructs a global taint tracking computation using flow state that also
417+ * allows a given maximum number of speculative taint steps.
418+ */
419+ module SpeculativeGlobalWithState<
420+ DataFlow:: StateConfigSig Config, speculationLimitSig / 0 speculationLimit> implements
421+ DataFlow:: GlobalFlowSig
422+ {
423+ private module Config0 implements DataFlowInternal:: FullStateConfigSig {
424+ import Config
425+
426+ predicate isAdditionalFlowStep (
427+ DataFlowLang:: Node node1 , DataFlowLang:: Node node2 , string model
428+ ) {
429+ Config:: isAdditionalFlowStep ( node1 , node2 ) and model = "Config"
430+ }
431+
432+ predicate isAdditionalFlowStep (
433+ DataFlowLang:: Node node1 , FlowState state1 , DataFlowLang:: Node node2 , FlowState state2 ,
434+ string model
435+ ) {
436+ Config:: isAdditionalFlowStep ( node1 , state1 , node2 , state2 ) and model = "Config"
437+ }
438+
439+ predicate observeOverlayInformedIncrementalMode ( ) {
440+ not Config:: observeDiffInformedIncrementalMode ( )
441+ }
442+ }
443+
444+ private module C implements DataFlowInternal:: FullStateConfigSig {
445+ import AddTaintDefaults< AddSpeculativeTaintSteps< Config0 , speculationLimit / 0 > >
446+ }
447+
448+ private module Stage1 = DataFlowInternalStage1:: ImplStage1< C > ;
449+
450+ import Stage1:: PartialFlow
451+
452+ private module Flow = DataFlowInternal:: OverlayImpl< C , Stage1:: Stage1WithState > ;
453+
454+ import Flow
455+ }
295456}
0 commit comments