Skip to content

Commit 052a331

Browse files
committed
rename ProcessEnvLabel to PartiallySensitiveMap
1 parent 2bd48db commit 052a331

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

javascript/ql/src/semmle/javascript/security/dataflow/CleartextLogging.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ module CleartextLogging {
3535
override predicate isSanitizer(DataFlow::Node node) { node instanceof Barrier }
3636

3737
override predicate isSanitizerEdge(DataFlow::Node pred, DataFlow::Node succ, DataFlow::FlowLabel lbl) {
38-
// Only unknown property reads on `process.env` propagate taint.
39-
(not lbl instanceof ProcessEnvLabel or exists(succ.(DataFlow::PropRead).getPropertyName())) and
38+
// Only unknown property reads on sensitive objects propagate taint.
39+
(not lbl instanceof PartiallySensitiveMap or exists(succ.(DataFlow::PropRead).getPropertyName())) and
4040
succ.(DataFlow::PropRead).getBase() = pred
4141
}
4242

4343
override predicate isAdditionalFlowStep(
4444
DataFlow::Node src, DataFlow::Node trg, DataFlow::FlowLabel inlbl, DataFlow::FlowLabel outlbl
4545
) {
4646
trg.(DataFlow::PropRead).getBase() = src and
47-
inlbl instanceof ProcessEnvLabel and
47+
inlbl instanceof PartiallySensitiveMap and
4848
outlbl.isData()
4949
}
5050

javascript/ql/src/semmle/javascript/security/dataflow/CleartextLoggingCustomizations.qll

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ module CleartextLogging {
163163
}
164164
}
165165

166-
166+
/** An access to the sensitive object `process.env`. */
167167
class ProcessEnvSource extends Source {
168168
ProcessEnvSource() {
169169
this = NodeJSLib::process().getAPropertyRead("env")
@@ -173,11 +173,16 @@ module CleartextLogging {
173173

174174
override DataFlow::FlowLabel getLabel() {
175175
result.isData() or
176-
result instanceof ProcessEnvLabel
176+
result instanceof PartiallySensitiveMap
177177
}
178178
}
179-
class ProcessEnvLabel extends DataFlow::FlowLabel{
180-
ProcessEnvLabel() {
179+
180+
/**
181+
* A flow label describing a map that might contain sensitive information in some properties.
182+
* Property reads on such maps where the property name is fixed is unlikely to leak sensitive information.
183+
*/
184+
class PartiallySensitiveMap extends DataFlow::FlowLabel {
185+
PartiallySensitiveMap() {
181186
this = "processEnv"
182187
}
183188
}

0 commit comments

Comments
 (0)