Skip to content

Commit 81ec686

Browse files
committed
Ruby: fix some SensitiveDataSource definitions
1 parent f217de9 commit 81ec686

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ private import ruby
88
private import codeql.ruby.Concepts
99
private import codeql.ruby.security.SensitiveActions
1010
private import codeql.ruby.dataflow.BarrierGuards
11+
private import codeql.ruby.dataflow.SSA
1112

1213
private module SensitiveDataSources {
1314
/**
@@ -42,28 +43,24 @@ private module SensitiveDataSources {
4243
/**
4344
* A call to a method that may return sensitive data.
4445
*/
45-
class SensitiveMethodCall extends SensitiveDataSource::Range, DataFlow::CallNode instanceof SensitiveNode
46-
{
47-
SensitiveDataMethodName methodName;
48-
49-
SensitiveMethodCall() { methodName = this.getMethodName() }
50-
46+
class SensitiveMethodCall extends SensitiveDataSource::Range instanceof SensitiveCall {
5147
override SensitiveDataClassification getClassification() {
52-
result = methodName.getClassification()
48+
result = SensitiveCall.super.getClassification()
5349
}
5450
}
5551

5652
/**
5753
* An assignment to a variable that may contain sensitive data.
5854
*/
59-
class SensitiveVariableAssignment extends SensitiveDataSource::Range instanceof SensitiveNode {
55+
class SensitiveVariableAssignment extends SensitiveDataSource::Range, DataFlow::SsaDefinitionNode {
56+
SensitiveNode sensitiveNode;
57+
6058
SensitiveVariableAssignment() {
61-
this.(DataFlow::VariableAccessNode).asVariableAccessAstNode() instanceof
62-
Ast::VariableWriteAccess
59+
this.getDefinition().(Ssa::WriteDefinition).getWriteAccess() = sensitiveNode.asExpr()
6360
}
6461

6562
override SensitiveDataClassification getClassification() {
66-
result = SensitiveNode.super.getClassification()
63+
result = sensitiveNode.getClassification()
6764
}
6865
}
6966

0 commit comments

Comments
 (0)