mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
address review feedback on MaskingReplacer
This commit is contained in:
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user