Skip to content

Commit

Permalink
Disable attr_accessible security in favor of strong_params
Browse files Browse the repository at this point in the history
MSP-11326
  • Loading branch information
mbuck-r7 committed Feb 4, 2015
1 parent c64434a commit 9fff11e
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 82 deletions.
1 change: 0 additions & 1 deletion lib/metasploit/model/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Metasploit::Model::Author
include Metasploit::Model::Translation

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Search

Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/authority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module Metasploit::Model::Authority
autoload :Zdi

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Search

Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/email_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Metasploit::Model::EmailAddress
include Metasploit::Model::Translation

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Derivation
include Metasploit::Model::Search
Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/module/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Metasploit::Model::Module::Action
include Metasploit::Model::Translation

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Search

Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/module/ancestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module Metasploit::Model::Module::Ancestor
SHA1_HEX_DIGEST_REGEXP = /\A[0-9a-z]{40}\Z/

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
include Metasploit::Model::Derivation
Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/module/path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Metasploit::Model::Module::Path

included do
include ActiveModel::Dirty
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
include Metasploit::Model::RealPathname
Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/module/rank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module Metasploit::Model::Module::Rank
NAME_BY_NUMBER = NUMBER_BY_NAME.invert

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Search

Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/module/target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module Metasploit::Model::Module::Target
autoload :Platform

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Search

Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ module Metasploit::Model::Platform
}

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Derivation
include Metasploit::Model::Search
Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/model/reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Metasploit::Model::Reference
include Metasploit::Model::Translation

included do
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Validations
include Metasploit::Model::Derivation
include Metasploit::Model::Search
Expand Down
4 changes: 0 additions & 4 deletions spec/support/shared/examples/metasploit/model/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:name) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :name, :type => :string
Expand Down
7 changes: 0 additions & 7 deletions spec/support/shared/examples/metasploit/model/authority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:abbreviation) }
it { should allow_mass_assignment_of(:obsolete) }
it { should allow_mass_assignment_of(:summary) }
it { should allow_mass_assignment_of(:url) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :abbreviation, :type => :string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:domain) }
it { should allow_mass_assignment_of(:full) }
it { should allow_mass_assignment_of(:local) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :domain, :type => :string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:name) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :name, :type => :string
Expand Down
27 changes: 0 additions & 27 deletions spec/support/shared/examples/metasploit/model/module/ancestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,33 +423,6 @@ def attribute_type(attribute)
end
end

context 'mass assignment security' do
it 'should not allow mass assignment of full_name since it must match derived_full_name' do
module_ancestor.should_not allow_mass_assignment_of(:full_name)
end

it { should allow_mass_assignment_of(:handler_type) }
it { should allow_mass_assignment_of(:module_type) }

it 'should not allow mass assignment of payload_type since it must match derived_payload_type' do
module_ancestor.should_not allow_mass_assignment_of(:payload_type)
end

it 'should allow mass assignment of real_path to allow derivation of module_type and reference_name' do
module_ancestor.should allow_mass_assignment_of(:real_path)
end

it 'should not allow mass assignment of real_path_modified_at since it is derived' do
module_ancestor.should_not allow_mass_assignment_of(:real_path_modified_at)
end

it 'should not allow mass assignment of real_path_sha1_hex_digest since it is derived' do
module_ancestor.should_not allow_mass_assignment_of(:real_path_sha1_hex_digest)
end

it { should_not allow_mass_assignment_of(:parent_path_id) }
end

context 'validations' do
subject(:module_ancestor) do
# Don't use factory so that nil values can be tested without the nil being replaced with derived value
Expand Down
6 changes: 0 additions & 6 deletions spec/support/shared/examples/metasploit/model/module/path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:gem) }
it { should allow_mass_assignment_of(:name) }
it { should allow_mass_assignment_of(:real_path) }
end

context 'validations' do
context 'directory' do
let(:error) do
Expand Down
5 changes: 0 additions & 5 deletions spec/support/shared/examples/metasploit/model/module/rank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:name) }
it { should allow_mass_assignment_of(:number) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :name, :type => :string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:name) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :name, :type => :string
Expand Down
4 changes: 0 additions & 4 deletions spec/support/shared/examples/metasploit/model/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@
it_should_behave_like 'derives', :fully_qualified_name, :validates => true
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:relative_name) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute',
Expand Down
5 changes: 0 additions & 5 deletions spec/support/shared/examples/metasploit/model/reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@
end
end

context 'mass assignment security' do
it { should allow_mass_assignment_of(:designation) }
it { should allow_mass_assignment_of(:url) }
end

context 'search' do
context 'attributes' do
it_should_behave_like 'search_attribute', :designation, :type => :string
Expand Down

0 comments on commit 9fff11e

Please sign in to comment.