@@ -15,9 +15,12 @@ import go
1515import  semmle.go.security.CommandInjection
1616import  semmle.go.security.FlowSources
1717
18+ /** 
19+  * Flow configuration for command injection 
20+  */ 
1821module  FlowConfig implements  DataFlow:: ConfigSig  { 
1922  predicate  isSource ( DataFlow:: Node  node )  { 
20-     exists ( UntrustedFlowSource  source ,  Function  function ,  DataFlow:: CallNode  callNode  | 
23+     exists ( RemoteFlowSource :: Range  source ,  Function  function ,  DataFlow:: CallNode  callNode  | 
2124      source .asExpr ( )  =  node .asExpr ( )  and 
2225      source .( DataFlow:: ExprNode ) .asExpr ( ) .getEnclosingFunction ( )  =  function .getFuncDecl ( )  and 
2326      ( 
@@ -33,11 +36,21 @@ module FlowConfig implements DataFlow::ConfigSig {
3336  predicate  isSink ( DataFlow:: Node  sink )  { 
3437    exists ( CommandInjection:: Sink  s  |  sink  =  s  |  not  s .doubleDashIsSanitizing ( ) ) 
3538  } 
39+ 
40+   predicate  isBarrier ( DataFlow:: Node  node )  {  node  instanceof  CommandInjection:: Sanitizer  } 
3641} 
3742
3843module  Flow =  TaintTracking:: Global< FlowConfig > ;
3944
40- from  Flow:: PathNode  source ,  Flow:: PathNode  sink 
41- where  Flow:: flowPath ( source ,  sink ) 
45+ module  FlowGraph = 
46+   DataFlow:: MergePathGraph< Flow:: PathNode ,  CommandInjection:: DoubleDashSanitizingFlow:: PathNode , 
47+     Flow:: PathGraph ,  CommandInjection:: DoubleDashSanitizingFlow:: PathGraph > ;
48+ 
49+ import  FlowGraph:: PathGraph
50+ 
51+ from  FlowGraph:: PathNode  source ,  FlowGraph:: PathNode  sink 
52+ where 
53+   Flow:: flowPath ( source .asPathNode1 ( ) ,  sink .asPathNode1 ( ) )  or 
54+   CommandInjection:: DoubleDashSanitizingFlow:: flowPath ( source .asPathNode2 ( ) ,  sink .asPathNode2 ( ) ) 
4255select  sink .getNode ( ) ,  source ,  sink ,  "This command depends on a $@." ,  source .getNode ( ) , 
4356  "user-provided value" 
0 commit comments