|
|
1244de |
From 7a01874b75fdd62ab3626490cdf1c65c0ba659d0 Mon Sep 17 00:00:00 2001
|
|
|
1244de |
From: Aaron Patterson <aaron.patterson@gmail.com>
|
|
|
1244de |
Date: Mon, 18 Jan 2016 13:51:02 -0800
|
|
|
1244de |
Subject: [PATCH] Eliminate instance level writers for class accessors
|
|
|
1244de |
|
|
|
1244de |
Instance level writers can have an impact on how the Active Model /
|
|
|
1244de |
Record objects are saved. Specifically, they can be used to bypass
|
|
|
1244de |
validations. This is a problem if mass assignment protection is
|
|
|
1244de |
disabled and specific attributes are passed to the constructor.
|
|
|
1244de |
|
|
|
1244de |
Conflicts:
|
|
|
1244de |
activerecord/lib/active_record/scoping/default.rb
|
|
|
1244de |
activesupport/lib/active_support/callbacks.rb
|
|
|
1244de |
|
|
|
1244de |
CVE-2016-0753
|
|
|
1244de |
---
|
|
|
1244de |
activemodel/lib/active_model/serializers/json.rb | 2 +-
|
|
|
1244de |
activemodel/lib/active_model/validations.rb | 3 ++-
|
|
|
1244de |
activerecord/lib/active_record/enum.rb | 2 +-
|
|
|
1244de |
activerecord/lib/active_record/reflection.rb | 4 ++--
|
|
|
1244de |
activesupport/lib/active_support/callbacks.rb | 2 +-
|
|
|
1244de |
5 files changed, 7 insertions(+), 6 deletions(-)
|
|
|
1244de |
|
|
|
1244de |
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
|
|
|
1244de |
index 3265d11..3ba690b 100644
|
|
|
1244de |
--- a/activesupport/lib/active_support/callbacks.rb
|
|
|
1244de |
+++ b/activesupport/lib/active_support/callbacks.rb
|
|
|
1244de |
@@ -726,7 +768,7 @@ module ActiveSupport
|
|
|
1244de |
end
|
|
|
1244de |
|
|
|
1244de |
names.each do |name|
|
|
|
1244de |
- class_attribute "_#{name}_callbacks"
|
|
|
1244de |
+ class_attribute "_#{name}_callbacks", instance_writer: false
|
|
|
1244de |
set_callbacks name, CallbackChain.new(name, options)
|
|
|
1244de |
end
|
|
|
1244de |
end
|
|
|
1244de |
--
|
|
|
1244de |
2.2.1
|
|
|
1244de |
|