Skip to content

Commit 7c1bd9a

Browse files
committed
Ruby: add a test case for cleartext logging that uses NonCleartextPasswordFlow
1 parent 83a3808 commit 7c1bd9a

File tree

1 file changed

+9
-0
lines changed
  • ruby/ql/test/query-tests/security/cwe-312

1 file changed

+9
-0
lines changed

ruby/ql/test/query-tests/security/cwe-312/logging.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,12 @@ def foo(password, logger)
8282
password_arg = "65f2950df2f0e2c38d7ba2ccca767291"
8383
foo(password_arg, stdout_logger)
8484
foo("65f2950df2f0e2c38d7ba2ccca767292", stdout_logger)
85+
86+
def redact(password)
87+
"***"
88+
end
89+
90+
password_r1 = redact("65f2950df2f0e2c38d7ba2ccca767291")
91+
password_r2 = password_r1
92+
# GOOD: password_r2 has been redacted
93+
stdout_logger.info password_r2

0 commit comments

Comments
 (0)