Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 863435 Details for
Bug 1065517
CVE-2014-0080 rubygem-activerecord: PostgreSQL array data injection vulnerability
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
4-1-beta-array_injection.patch
4-1-beta-array_injection.patch (text/plain), 2.19 KB, created by
Kurt Seifried
on 2014-02-14 21:40:21 UTC
(
hide
)
Description:
4-1-beta-array_injection.patch
Filename:
MIME Type:
Creator:
Kurt Seifried
Created:
2014-02-14 21:40:21 UTC
Size:
2.19 KB
patch
obsolete
>From 20406b952280259165c126d1e956719cccf4a2d0 Mon Sep 17 00:00:00 2001 >From: Aaron Patterson <aaron.patterson@gmail.com> >Date: Wed, 12 Feb 2014 16:22:40 -0800 >Subject: [PATCH] Correctly escape PostgreSQL arrays. > >Thanks Godfrey Chan for reporting this! >--- > .../lib/active_record/connection_adapters/postgresql/cast.rb | 6 +++++- > activerecord/test/cases/adapters/postgresql/datatype_test.rb | 8 ++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > >diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb >index 35ce881..68da526 100644 >--- a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb >+++ b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb >@@ -142,12 +142,16 @@ module ActiveRecord > end > end > >+ ARRAY_ESCAPE = "\\" * 2 * 2 # escape the backslash twice for PG arrays >+ > def quote_and_escape(value) > case value > when "NULL", Numeric > value > else >- "\"#{value.gsub(/"/,"\\\"")}\"" >+ value = value.gsub(/\\/, ARRAY_ESCAPE) >+ value.gsub!(/"/,"\\\"") >+ "\"#{value}\"" > end > end > >diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb >index 04a458f..5c3a797 100644 >--- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb >+++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb >@@ -78,6 +78,14 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase > PostgresqlBitString, PostgresqlOid, PostgresqlTimestampWithZone, PostgresqlUUID].each(&:delete_all) > end > >+ def test_array_escaping >+ unknown = %(foo\\",bar,baz,\\) >+ nicknames = ["hello_#{unknown}"] >+ ar = PostgresqlArray.create!(nicknames: nicknames, id: 100) >+ ar.reload >+ assert_equal nicknames, ar.nicknames >+ end >+ > def test_data_type_of_array_types > assert_equal :integer, @first_array.column_for_attribute(:commission_by_quarter).type > assert_equal :text, @first_array.column_for_attribute(:nicknames).type >-- >1.8.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1065517
:
863434
| 863435