@@ -84,6 +84,13 @@ private predicate writesProperty(DataFlow::Node node, string name) {
8484 node .( DataFlow:: CallNode ) .getArgument ( 0 ) .asExpr ( ) .getConstantValue ( ) .isStringlikeValue ( name )
8585}
8686
87+ /**
88+ * Instance and class variable names are reported with their respective `@`
89+ * and `@@` prefixes. This predicate strips these prefixes.
90+ */
91+ bindingset [ name]
92+ private string unprefixedVariableName ( string name ) { result = name .regexpReplaceAll ( "^@*" , "" ) }
93+
8794/** A write to a variable or property that might contain sensitive data. */
8895private class BasicSensitiveWrite extends SensitiveWrite {
8996 SensitiveDataClassification classification ;
@@ -104,7 +111,7 @@ private class BasicSensitiveWrite extends SensitiveWrite {
104111 */
105112
106113 writesProperty ( this , name ) and
107- nameIndicatesSensitiveData ( name , classification )
114+ nameIndicatesSensitiveData ( unprefixedVariableName ( name ) , classification )
108115 )
109116 }
110117
@@ -116,7 +123,9 @@ private class BasicSensitiveWrite extends SensitiveWrite {
116123private class BasicSensitiveVariableAccess extends SensitiveVariableAccess {
117124 SensitiveDataClassification classification ;
118125
119- BasicSensitiveVariableAccess ( ) { nameIndicatesSensitiveData ( name , classification ) }
126+ BasicSensitiveVariableAccess ( ) {
127+ nameIndicatesSensitiveData ( unprefixedVariableName ( name ) , classification )
128+ }
120129
121130 override SensitiveDataClassification getClassification ( ) { result = classification }
122131}
0 commit comments