File tree Expand file tree Collapse file tree 1 file changed +7
-16
lines changed
ruby/ql/lib/codeql/ruby/security Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -70,23 +70,14 @@ module CleartextLogging {
70
70
}
71
71
72
72
/**
73
- * A node sanitized by a prior call to `sub!` or `gsub!`,
74
- * e.g. the `password` argument to `info` in:
75
- * ```
76
- * password = "changeme"
77
- * password.sub!(/.+/, "")
78
- * Logger.new(STDOUT).info password
79
- * ```
73
+ * Like `MaskingReplacerSanitizer` but updates the receiver for methods that
74
+ * sanitize the receiver.
75
+ * Taint is thereby cleared for any subsequent read.
80
76
*/
81
- private class MaskingReplacerSanitizedNode extends Sanitizer {
82
- MaskingReplacerSanitizedNode ( ) {
83
- exists ( Ssa:: Definition def |
84
- exists ( MaskingReplacerSanitizer maskCall |
85
- maskCall .getMethodName ( ) = [ "sub!" , "gsub!" ] and
86
- def .hasAdjacentReads ( maskCall .getReceiver ( ) .asExpr ( ) , this .asExpr ( ) )
87
- )
88
- or
89
- def .hasAdjacentReads ( any ( MaskingReplacerSanitizedNode read ) .asExpr ( ) , this .asExpr ( ) )
77
+ private class InPlaceMaskingReplacerSanitizer extends Sanitizer {
78
+ InPlaceMaskingReplacerSanitizer ( ) {
79
+ exists ( MaskingReplacerSanitizer m | m .getMethodName ( ) = [ "gsub!" , "sub!" ] |
80
+ m .getReceiver ( ) = this
90
81
)
91
82
}
92
83
}
You can’t perform that action at this time.
0 commit comments