Skip to content

Commit 532fc08

Browse files
committed
Ruby: Fix inconsistencies in checking for sensitive names in CleartextSources
1 parent 8be1be3 commit 532fc08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ruby/ql/lib/codeql/ruby/security/internal/CleartextSources.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ module CleartextSources {
196196
HashLiteralPasswordSource() {
197197
exists(DataFlow::Node val, CfgNodes::ExprNodes::HashLiteralCfgNode lit |
198198
name.regexpMatch(maybePassword()) and
199-
not name.regexpMatch(notSensitiveRegexp()) and
199+
not nameIsNotSensitive(name) and
200200
// avoid safe values assigned to presumably unsafe names
201201
not val instanceof NonCleartextPassword and
202202
// hash = { name: val }
@@ -220,6 +220,7 @@ module CleartextSources {
220220
// avoid safe values assigned to presumably unsafe names
221221
not this instanceof NonCleartextPassword and
222222
name.regexpMatch(maybePassword()) and
223+
not nameIsNotSensitive(name) and
223224
exists(Assignment a |
224225
this.asExpr().getExpr() = a.getRightOperand() and
225226
a.getLeftOperand().getAVariable().getName() = name
@@ -235,6 +236,7 @@ module CleartextSources {
235236

236237
ParameterPasswordSource() {
237238
name.regexpMatch(maybePassword()) and
239+
not nameIsNotSensitive(name) and
238240
not this instanceof NonCleartextPassword and
239241
exists(Parameter p, LocalVariable v |
240242
v = p.getAVariable() and

0 commit comments

Comments
 (0)