Skip to content

Commit 94fec5f

Browse files
committed
JS: Rewrite to use SensitiveDataClassification
1 parent 0d08718 commit 94fec5f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

javascript/ql/src/semmle/javascript/security/SensitiveActions.qll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class SensitiveExpr extends Expr {
1919
abstract string describe();
2020

2121
/** Gets a classification of the kind of sensitive data this expression might contain. */
22-
abstract SensitiveExpr::Classification getClassification();
22+
abstract SensitiveDataClassification getClassification();
2323
}
2424

2525
/** DEPRECATED: Use `SensitiveDataClassification` and helpers instead. */
@@ -42,7 +42,7 @@ deprecated module SensitiveExpr {
4242

4343
/** A function call that might produce sensitive data. */
4444
class SensitiveCall extends SensitiveExpr, InvokeExpr {
45-
SensitiveExpr::Classification classification;
45+
SensitiveDataClassification classification;
4646

4747
SensitiveCall() {
4848
classification = this.getCalleeName().(SensitiveDataFunctionName).getClassification()
@@ -57,7 +57,7 @@ class SensitiveCall extends SensitiveExpr, InvokeExpr {
5757

5858
override string describe() { result = "a call to " + getCalleeName() }
5959

60-
override SensitiveExpr::Classification getClassification() { result = classification }
60+
override SensitiveDataClassification getClassification() { result = classification }
6161
}
6262

6363
/** An access to a variable or property that might contain sensitive data. */
@@ -81,7 +81,7 @@ abstract class SensitiveWrite extends DataFlow::Node { }
8181

8282
/** A write to a variable or property that might contain sensitive data. */
8383
private class BasicSensitiveWrite extends SensitiveWrite {
84-
SensitiveExpr::Classification classification;
84+
SensitiveDataClassification classification;
8585

8686
BasicSensitiveWrite() {
8787
exists(string name |
@@ -102,18 +102,18 @@ private class BasicSensitiveWrite extends SensitiveWrite {
102102
}
103103

104104
/** Gets a classification of the kind of sensitive data the write might handle. */
105-
SensitiveExpr::Classification getClassification() { result = classification }
105+
SensitiveDataClassification getClassification() { result = classification }
106106
}
107107

108108
/** An access to a variable or property that might contain sensitive data. */
109109
private class BasicSensitiveVariableAccess extends SensitiveVariableAccess {
110-
SensitiveExpr::Classification classification;
110+
SensitiveDataClassification classification;
111111

112112
BasicSensitiveVariableAccess() {
113113
name.regexpMatch(maybeSensitive(classification)) and not name.regexpMatch(notSensitive())
114114
}
115115

116-
override SensitiveExpr::Classification getClassification() { result = classification }
116+
override SensitiveDataClassification getClassification() { result = classification }
117117
}
118118

119119
/** A function name that suggests it may be sensitive. */
@@ -128,16 +128,16 @@ abstract class SensitiveFunctionName extends string {
128128
/** A function name that suggests it may produce sensitive data. */
129129
abstract class SensitiveDataFunctionName extends SensitiveFunctionName {
130130
/** Gets a classification of the kind of sensitive data this function may produce. */
131-
abstract SensitiveExpr::Classification getClassification();
131+
abstract SensitiveDataClassification getClassification();
132132
}
133133

134134
/** A method that might return sensitive data, based on the name. */
135135
class CredentialsFunctionName extends SensitiveDataFunctionName {
136-
SensitiveExpr::Classification classification;
136+
SensitiveDataClassification classification;
137137

138138
CredentialsFunctionName() { this.regexpMatch(maybeSensitive(classification)) }
139139

140-
override SensitiveExpr::Classification getClassification() { result = classification }
140+
override SensitiveDataClassification getClassification() { result = classification }
141141
}
142142

143143
/**
@@ -173,7 +173,7 @@ class CleartextPasswordExpr extends SensitiveExpr {
173173

174174
override string describe() { none() }
175175

176-
override SensitiveExpr::Classification getClassification() { none() }
176+
override SensitiveDataClassification getClassification() { none() }
177177
}
178178

179179
/**

0 commit comments

Comments
 (0)