Skip to content

Commit 7b4af39

Browse files
committed
Ruby: track masked variables potentially containing sensitive data more accurately
1 parent 59ab384 commit 7b4af39

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ruby/ql/lib/codeql/ruby/security/CleartextLoggingCustomizations.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ module CleartextLogging {
8585
*/
8686
private class MaskingReplacerSanitizedNode extends SanitizerIn {
8787
MaskingReplacerSanitizedNode() {
88-
exists(MaskingReplacerSanitizer maskCall, Variable v |
89-
maskCall.getMethodName() = ["sub!", "gsub!"] and
90-
v = maskCall.getReceiver().asExpr().getExpr().(VariableReadAccess).getVariable() and
91-
v = this.asExpr().getExpr().(VariableReadAccess).getVariable() and
92-
maskCall.asExpr().getASuccessor*() = this.asExpr()
88+
exists(Ssa::Definition def |
89+
exists(MaskingReplacerSanitizer maskCall |
90+
maskCall.getMethodName() = ["sub!", "gsub!"] and
91+
def.hasAdjacentReads(maskCall.getReceiver().asExpr(), this.asExpr())
92+
)
93+
or
94+
def.hasAdjacentReads(any(MaskingReplacerSanitizedNode read).asExpr(), this.asExpr())
9395
)
9496
}
9597
}

0 commit comments

Comments
 (0)