File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/semmle/python/dataflow/new
test/experimental/dataflow/sensitive-data Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -149,4 +149,15 @@ private module SensitiveDataModeling {
149
149
150
150
override SensitiveDataClassification getClassification ( ) { result = classification }
151
151
}
152
+
153
+ /** A parameter where the name indicates it will receive sensitive data. */
154
+ class SensitiveParameter extends SensitiveDataSource:: Range , DataFlow:: ParameterNode {
155
+ SensitiveDataClassification classification ;
156
+
157
+ SensitiveParameter ( ) {
158
+ nameIndicatesSensitiveData ( this .getParameter ( ) .getName ( ) , classification )
159
+ }
160
+
161
+ override SensitiveDataClassification getClassification ( ) { result = classification }
162
+ }
152
163
}
Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ def encrypt_password(pwd):
29
29
foo .secret # $ SensitiveDataSource=secret
30
30
foo .username # $ SensitiveDataSource=id
31
31
32
- # plain variables
32
+ # based on variable/parameter names
33
+ def my_func (password ): # $ SensitiveDataSource=password
34
+ print (password ) # $ SensitiveUse=password
35
+
33
36
password = some_function ()
34
37
print (password ) # $ MISSING: SensitiveUse=password
35
38
You can’t perform that action at this time.
0 commit comments