Skip to content

Commit c341643

Browse files
committed
Python: Add more tests for sensitive function handling
1 parent eb4f168 commit c341643

File tree

1 file changed

+19
-0
lines changed
  • python/ql/test/experimental/dataflow/sensitive-data

1 file changed

+19
-0
lines changed

python/ql/test/experimental/dataflow/sensitive-data/test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ def encrypt_password(pwd):
2424
f = get_password
2525
f() # $ SensitiveDataSource=password
2626

27+
# more tests of functions we don't have definition for
28+
x = unkown_func_not_even_imported_get_password() # $ SensitiveDataSource=password
29+
print(x) # $ SensitiveUse=password
30+
31+
f = get_passwd
32+
x = f() # $ MISSING: SensitiveDataSource=password
33+
print(x) # $ MISSING: SensitiveUse=password
34+
35+
import not_found
36+
f = not_found.get_passwd # $ SensitiveDataSource=password
37+
x = f() # $ MISSING: SensitiveDataSource=password
38+
print(x) # $ MISSING: SensitiveUse=password
39+
40+
def my_func(non_sensitive_name):
41+
x = non_sensitive_name() # $ MISSING: SensitiveDataSource=password
42+
print(x) # $ MISSING: SensitiveUse=password
43+
f = not_found.get_passwd # $ SensitiveDataSource=password
44+
my_func(f)
45+
2746
# attributes
2847
foo = ObjectFromDatabase()
2948
foo.secret # $ SensitiveDataSource=secret

0 commit comments

Comments
 (0)