Skip to content

Commit 3b68c87

Browse files
committed
Python: Add sensitive data test-cases
1 parent 79bef11 commit 3b68c87

File tree

1 file changed

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

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,24 @@ def encrypt_password(pwd):
2020
account_id() # $ SensitiveDataSource=id
2121
safe_to_store = encrypt_password(pwd)
2222

23+
f = get_password
24+
f() # $ SensitiveDataSource=password
25+
2326
# attributes
2427
foo = ObjectFromDatabase()
2528
foo.secret # $ SensitiveDataSource=secret
2629
foo.username # $ SensitiveDataSource=id
2730

31+
# plain variables
32+
password = some_function()
33+
print(password) # $ MISSING: SensitiveDataSource=password
34+
2835
# Special handling of lookups of sensitive properties
2936
request.args["password"], # $ MISSING: SensitiveDataSource=password
3037
request.args.get("password") # $ SensitiveDataSource=password
3138

39+
x = "password"
40+
request.args.get(x) # $ SensitiveDataSource=password
41+
3242
# I don't think handling `getlist` is super important, just included it to show what we don't handle
3343
request.args.getlist("password")[0] # $ MISSING: SensitiveDataSource=password

0 commit comments

Comments
 (0)