Skip to content

Commit 42b40e4

Browse files
Copilotbmhughes
authored andcommitted
Fix backslash escaping in SCRAM-SHA-256 password handling
Changed from excessive \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ (8 backslashes) to proper \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ (4 backslashes) for SQL escaping. Each backslash in the original password is now correctly escaped as \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ (2 backslashes) in the result. Co-authored-by: bmhughes <[email protected]>
1 parent e4937c8 commit 42b40e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/sql/role.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def escape_password_for_sql(password)
6868
# SCRAM-SHA-256 passwords contain $ characters that can be interpreted
6969
# by shell or string processing. Escape them to prevent mangling.
7070
if password.start_with?('SCRAM-SHA-256')
71-
password.gsub('\\', '\\\\\\\\').gsub("'", "''").gsub('$', '\\$')
71+
password.gsub('\\', '\\\\').gsub("'", "''").gsub('$', '\\$')
7272
else
7373
password.gsub("'", "''")
7474
end

0 commit comments

Comments
 (0)