@@ -78,3 +78,37 @@ def my_func(password): # $ SensitiveDataSource=password
78
78
79
79
from not_found import password2 as foo # $ SensitiveDataSource=password
80
80
print (foo ) # $ SensitiveUse=password
81
+
82
+ # ------------------------------------------------------------------------------
83
+ # cross-talk between different calls
84
+ # ------------------------------------------------------------------------------
85
+
86
+ # Case 1: providing name as argument
87
+
88
+ _configuration = {"sleep_timer" : 5 , "mysql_password" : "1234" }
89
+
90
+ def get_config (key ):
91
+ # Treating this as a SensitiveDataSource is questionable, since that will result in
92
+ # _all_ calls to `get_config` being treated as giving sensitive data
93
+ return _configuration [key ] # $ SensitiveDataSource=password
94
+
95
+ foo = get_config ("mysql_password" )
96
+ print (foo ) # $ SensitiveUse=password
97
+
98
+ bar = get_config ("sleep_timer" )
99
+ print (bar ) # $ SPURIOUS: SensitiveUse=password
100
+
101
+ # Case 2: Providing function as argument
102
+
103
+ def call_wrapper (func ):
104
+ print ("Will call" , func )
105
+ # Treating this as a SensitiveDataSource is questionable, since that will result in
106
+ # _all_ calls to `call_wrapper` being treated as giving sensitive data
107
+ return func () # $ SensitiveDataSource=password
108
+
109
+ foo = call_wrapper (get_password )
110
+ print (foo ) # $ SensitiveUse=password
111
+
112
+ harmless = lambda : "bar"
113
+ bar = call_wrapper (harmless )
114
+ print (bar ) # $ SPURIOUS: SensitiveUse=password
0 commit comments