Skip to content

Commit 3d40e50

Browse files
Potential fix for code scanning alert no. 6: Incomplete string escaping or encoding
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent e86ab3b commit 3d40e50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/sql/role.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ 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('$', '\\$')
71+
password.gsub('\\', '\\\\\\\\').gsub("'", "''").gsub('$', '\\$')
7272
else
73-
password
73+
password.gsub("'", "''")
7474
end
7575
end
7676

0 commit comments

Comments
 (0)