address review feedback on MaskingReplacer

This commit is contained in:
Erik Krogh Kristensen
2019-11-12 11:30:17 +01:00
parent 4ec2070e48
commit 8ff515a58d
3 changed files with 36 additions and 16 deletions

View File

@@ -34,19 +34,19 @@ module CleartextLogging {
abstract class Barrier extends DataFlow::Node { }
/**
* A call to `.replace()` that seems to mask
* A call to `.replace()` that seems to mask sensitive information.
*/
class MaskingReplacer extends Barrier, DataFlow::MethodCallNode {
MaskingReplacer() {
this.getCalleeName() = "replace" and
exists(RegExpLiteral reg|
reg = this.getArgument(0).getALocalSource().asExpr() and
reg.getFlags().regexpMatch("(?i).*g.*") and
reg.getRoot().getRawValue().regexpMatch(".*\\..*")
)
and
this.getArgument(1).asExpr() instanceof StringLiteral
}
MaskingReplacer() {
this.getCalleeName() = "replace" and
exists(RegExpLiteral reg |
reg = this.getArgument(0).getALocalSource().asExpr() and
reg.isGlobal() and
any(RegExpDot term).getLiteral() = reg
)
and
exists(this.getArgument(1).getStringValue())
}
}
/**