@@ -15,23 +15,26 @@ import java
1515import semmle.code.java.dataflow.DataFlow
1616import semmle.code.java.dataflow.FlowSources
1717import semmle.code.java.dataflow.TaintTracking2
18- import DataFlow:: PathGraph
18+ // import DataFlow::PathGraph
1919// Internal
2020import github.Logging
2121import github.SensitiveInformation
2222
23- class SensitiveInformationLoggingConfig extends TaintTracking :: Configuration {
24- SensitiveInformationLoggingConfig ( ) { this = "SensitiveInformationLoggingConfig" }
23+ module SensitiveInformationConfig implements DataFlow :: ConfigSig {
24+ predicate isSource ( DataFlow :: Node source ) { source instanceof SensitiveInformationSources }
2525
26- override predicate isSource ( DataFlow:: Node source ) {
27- source instanceof SensitiveInformationSources
28- }
26+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof LoggingMethodsSinks }
2927
30- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof LoggingMethodsSinks }
28+ predicate isBarrier ( DataFlow:: Node node ) {
29+ exists ( Type t | t = node .getType ( ) | t instanceof BoxedType or t instanceof PrimitiveType )
30+ }
3131}
3232
33+ module SensitiveInformationFlow = TaintTracking:: Global< SensitiveInformationConfig > ;
34+ import SensitiveInformationFlow:: PathGraph //importing the path graph from the module
35+
36+
3337// ========== Query ==========
34- from DataFlow:: PathNode source , DataFlow:: PathNode sink , SensitiveInformationLoggingConfig config
35- where config .hasFlowPath ( source , sink )
36- select sink .getNode ( ) , source , sink , "Sensative data is being logged $@." , source .getNode ( ) ,
37- "user-provided value"
38+ from SensitiveInformationFlow:: PathNode source , SensitiveInformationFlow:: PathNode sink
39+ where SensitiveInformationFlow:: flowPath ( source , sink ) //using flowPath instead of hasFlowPath
40+ select sink .getNode ( ) , source , sink , "Sensative data is being logged $@." , source .getNode ( ) , "user-provided value"
0 commit comments