Skip to content

Commit 23d1451

Browse files
committed
Upgraded Ruby to 2.7.0-preview1 and Rails to 6.0.0 - fixed 1 spec
1 parent 0dcadc0 commit 23d1451

12 files changed

+87
-59
lines changed

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.4
1+
2.7.0-preview1

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: ruby
22
rvm:
33
- "2.6.4"
4+
- "2.7.0-preview1"
45

56
before_install:
67
- "phantomjs --version"

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:2.6.2
1+
FROM ruby:2.7.0-preview1
22
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
33
RUN mkdir /myapp
44
WORKDIR /myapp

Gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
source "https://rubygems.org"
33

44
#don't upgrade
5-
gem "rails", "5.1.7"
5+
gem "rails", "6.0.0"
66

7-
ruby "2.6.4"
7+
ruby "2.7.0"
88

99
gem "aruba"
1010
gem "bcrypt"

Gemfile.lock

+73-47
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (5.1.7)
5-
actionpack (= 5.1.7)
4+
actioncable (6.0.0)
5+
actionpack (= 6.0.0)
66
nio4r (~> 2.0)
7-
websocket-driver (~> 0.6.1)
8-
actionmailer (5.1.7)
9-
actionpack (= 5.1.7)
10-
actionview (= 5.1.7)
11-
activejob (= 5.1.7)
7+
websocket-driver (>= 0.6.1)
8+
actionmailbox (6.0.0)
9+
actionpack (= 6.0.0)
10+
activejob (= 6.0.0)
11+
activerecord (= 6.0.0)
12+
activestorage (= 6.0.0)
13+
activesupport (= 6.0.0)
14+
mail (>= 2.7.1)
15+
actionmailer (6.0.0)
16+
actionpack (= 6.0.0)
17+
actionview (= 6.0.0)
18+
activejob (= 6.0.0)
1219
mail (~> 2.5, >= 2.5.4)
1320
rails-dom-testing (~> 2.0)
14-
actionpack (5.1.7)
15-
actionview (= 5.1.7)
16-
activesupport (= 5.1.7)
21+
actionpack (6.0.0)
22+
actionview (= 6.0.0)
23+
activesupport (= 6.0.0)
1724
rack (~> 2.0)
1825
rack-test (>= 0.6.3)
1926
rails-dom-testing (~> 2.0)
20-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21-
actionview (5.1.7)
22-
activesupport (= 5.1.7)
27+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28+
actiontext (6.0.0)
29+
actionpack (= 6.0.0)
30+
activerecord (= 6.0.0)
31+
activestorage (= 6.0.0)
32+
activesupport (= 6.0.0)
33+
nokogiri (>= 1.8.5)
34+
actionview (6.0.0)
35+
activesupport (= 6.0.0)
2336
builder (~> 3.1)
2437
erubi (~> 1.4)
2538
rails-dom-testing (~> 2.0)
26-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27-
activejob (5.1.7)
28-
activesupport (= 5.1.7)
39+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40+
activejob (6.0.0)
41+
activesupport (= 6.0.0)
2942
globalid (>= 0.3.6)
30-
activemodel (5.1.7)
31-
activesupport (= 5.1.7)
32-
activerecord (5.1.7)
33-
activemodel (= 5.1.7)
34-
activesupport (= 5.1.7)
35-
arel (~> 8.0)
36-
activesupport (5.1.7)
43+
activemodel (6.0.0)
44+
activesupport (= 6.0.0)
45+
activerecord (6.0.0)
46+
activemodel (= 6.0.0)
47+
activesupport (= 6.0.0)
48+
activestorage (6.0.0)
49+
actionpack (= 6.0.0)
50+
activejob (= 6.0.0)
51+
activerecord (= 6.0.0)
52+
marcel (~> 0.3.1)
53+
activesupport (6.0.0)
3754
concurrent-ruby (~> 1.0, >= 1.0.2)
3855
i18n (>= 0.7, < 2)
3956
minitest (~> 5.1)
4057
tzinfo (~> 1.1)
58+
zeitwerk (~> 2.1, >= 2.1.8)
4159
addressable (2.7.0)
4260
public_suffix (>= 2.0.2, < 5.0)
43-
arel (8.0.0)
4461
aruba (0.14.11)
4562
childprocess (>= 0.6.3, < 3.0.0)
4663
contracts (~> 0.9)
@@ -73,9 +90,9 @@ GEM
7390
rake (< 13.0)
7491
cliver (0.3.2)
7592
coderay (1.1.2)
76-
coffee-rails (4.2.2)
93+
coffee-rails (5.0.0)
7794
coffee-script (>= 2.2.0)
78-
railties (>= 4.0.0)
95+
railties (>= 5.2.0)
7996
coffee-script (2.4.1)
8097
coffee-script-source
8198
execjs
@@ -103,15 +120,17 @@ GEM
103120
debug_inspector (0.0.3)
104121
diff-lcs (1.3)
105122
docile (1.3.2)
123+
dotenv (0.7.0)
106124
em-websocket (0.5.1)
107125
eventmachine (>= 0.12.9)
108126
http_parser.rb (~> 0.6.0)
109127
erubi (1.8.0)
110128
eventmachine (1.2.7)
111129
execjs (2.7.0)
112130
ffi (1.11.1)
113-
foreman (0.85.0)
114-
thor (~> 0.19.1)
131+
foreman (0.64.0)
132+
dotenv (~> 0.7.0)
133+
thor (>= 0.13.6)
115134
formatador (0.2.5)
116135
gherkin (5.1.0)
117136
globalid (0.4.2)
@@ -165,7 +184,10 @@ GEM
165184
lumberjack (1.0.13)
166185
mail (2.7.1)
167186
mini_mime (>= 0.1.1)
187+
marcel (0.3.3)
188+
mimemagic (~> 0.3.2)
168189
method_source (0.9.2)
190+
mimemagic (0.3.3)
169191
mini_mime (1.0.2)
170192
mini_portile2 (2.4.0)
171193
minitest (5.11.3)
@@ -202,30 +224,33 @@ GEM
202224
rack
203225
rack-test (1.1.0)
204226
rack (>= 1.0, < 3)
205-
rails (5.1.7)
206-
actioncable (= 5.1.7)
207-
actionmailer (= 5.1.7)
208-
actionpack (= 5.1.7)
209-
actionview (= 5.1.7)
210-
activejob (= 5.1.7)
211-
activemodel (= 5.1.7)
212-
activerecord (= 5.1.7)
213-
activesupport (= 5.1.7)
227+
rails (6.0.0)
228+
actioncable (= 6.0.0)
229+
actionmailbox (= 6.0.0)
230+
actionmailer (= 6.0.0)
231+
actionpack (= 6.0.0)
232+
actiontext (= 6.0.0)
233+
actionview (= 6.0.0)
234+
activejob (= 6.0.0)
235+
activemodel (= 6.0.0)
236+
activerecord (= 6.0.0)
237+
activestorage (= 6.0.0)
238+
activesupport (= 6.0.0)
214239
bundler (>= 1.3.0)
215-
railties (= 5.1.7)
240+
railties (= 6.0.0)
216241
sprockets-rails (>= 2.0.0)
217242
rails-dom-testing (2.0.3)
218243
activesupport (>= 4.2.0)
219244
nokogiri (>= 1.6)
220245
rails-html-sanitizer (1.2.0)
221246
loofah (~> 2.2, >= 2.2.2)
222247
rails-perftest (0.0.7)
223-
railties (5.1.7)
224-
actionpack (= 5.1.7)
225-
activesupport (= 5.1.7)
248+
railties (6.0.0)
249+
actionpack (= 6.0.0)
250+
activesupport (= 6.0.0)
226251
method_source
227252
rake (>= 0.8.7)
228-
thor (>= 0.18.1, < 2.0)
253+
thor (>= 0.20.3, < 2.0)
229254
rainbow (3.0.0)
230255
raindrops (0.19.0)
231256
rake (12.3.3)
@@ -300,7 +325,7 @@ GEM
300325
therubyracer (0.12.3)
301326
libv8 (~> 3.16.14.15)
302327
ref
303-
thor (0.19.4)
328+
thor (0.20.3)
304329
thread_safe (0.3.6)
305330
tilt (2.0.9)
306331
travis-lint (2.0.0)
@@ -316,11 +341,12 @@ GEM
316341
unicorn (5.5.1)
317342
kgio (~> 2.6)
318343
raindrops (~> 0.7)
319-
websocket-driver (0.6.5)
344+
websocket-driver (0.7.1)
320345
websocket-extensions (>= 0.1.0)
321346
websocket-extensions (0.1.4)
322347
xpath (3.2.0)
323348
nokogiri (~> 1.8)
349+
zeitwerk (2.1.10)
324350

325351
PLATFORMS
326352
ruby
@@ -350,7 +376,7 @@ DEPENDENCIES
350376
pry-rails
351377
puma
352378
rack-livereload
353-
rails (= 5.1.7)
379+
rails (= 6.0.0)
354380
rails-perftest
355381
rake
356382
rb-fsevent
@@ -369,7 +395,7 @@ DEPENDENCIES
369395
unicorn
370396

371397
RUBY VERSION
372-
ruby 2.6.4p104
398+
ruby 2.7.0p-1
373399

374400
BUNDLED WITH
375-
1.17.3
401+
2.1.0.pre.1

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RailsGoat [![Build Status](https://api.travis-ci.org/OWASP/railsgoat.png?branch=master)](https://travis-ci.org/OWASP/railsgoat) [![Code Climate](https://codeclimate.com/github/OWASP/railsgoat.png)](https://codeclimate.com/github/OWASP/railsgoat)
22

3-
RailsGoat is a vulnerable version of the Ruby on Rails Framework from versions 3 to 5. It includes vulnerabilities from the OWASP Top 10, as well as some "extras" that the initial project contributors felt worthwhile to share. This project is designed to educate both developers, as well as security professionals.
3+
RailsGoat is a vulnerable version of the Ruby on Rails Framework from versions 3 to 6. It includes vulnerabilities from the OWASP Top 10, as well as some "extras" that the initial project contributors felt worthwhile to share. This project is designed to educate both developers, as well as security professionals.
44

55
## Support
66

@@ -18,7 +18,7 @@ After installing the above software, clone this repo:
1818
$ git clone git@github.com:OWASP/railsgoat.git
1919
```
2020

21-
**NOTE: NOT NECESSARY IF YOU WANT TO WORK WITH RAILS 5.** Otherwise, if you wish to use the Rails 3 or 4 versions, you'll need to switch branches:
21+
**NOTE: NOT NECESSARY IF YOU WANT TO WORK WITH RAILS 6.** Otherwise, if you wish to use the Rails 3 or 4 versions, you'll need to switch branches:
2222

2323
```bash
2424
$ cd railsgoat
@@ -73,7 +73,7 @@ Note: if your container exits with an error, it may be because a server is alrea
7373
```
7474
A server is already running. Check /myapp/tmp/pids/server.pid.
7575
=> Booting Thin
76-
=> Rails 5.0.1 application starting in development on
76+
=> Rails 6.0.0 application starting in development on
7777
http://0.0.0.0:3000
7878
=> Run `rails server -h` for more startup options
7979
=> Ctrl-C to shutdown server

app/controllers/admin_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_user
3434
def update_user
3535
user = User.find_by_id(params[:admin_id])
3636
if user
37-
user.update_attributes(params[:user].reject { |k| k == ("password" || "password_confirmation") })
37+
user.update(params[:user].reject { |k| k == ("password" || "password_confirmation") })
3838
pass = params[:user][:password]
3939
user.password = pass if !(pass.blank?)
4040
user.save!

app/controllers/users_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def update
2929
user = User.where("id = '#{params[:user][:id]}'")[0]
3030

3131
if user
32-
user.update_attributes(user_params_without_password)
32+
user.update(user_params_without_password)
3333
if params[:user][:password].present? && (params[:user][:password] == params[:user][:password_confirmation])
3434
user.password = params[:user][:password]
3535
end

config/application.rb

+2
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ class Application < Rails::Application
5555
config.assets.version = "1.0"
5656

5757
I18n.config.enforce_available_locales = false
58+
59+
config.action_dispatch.return_only_media_type_on_content_type = false
5860
end
5961
end

config/initializers/secret_token.rb

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
# If you change this key, all old signed cookies will become invalid!
66
# Make sure the secret is at least 30 characters and all random,
77
# no regular words or you'll be exposed to dictionary attacks.
8-
Railsgoat::Application.config.secret_token = "2f1d90a26236c3245d96f5606c201a780dc9ca687e5ed82b45e211bb5dc84c1870f61ca9e002dad5dd8a149c9792d8f07f31a9575065cca064bd6af44f8750e4"
98
Railsgoat::Application.config.secret_key_base = "2f1d90a26236c3245d96f5606c201a780dc9ca687e5ed82b45e211bb5dc84c1870f61ca9e002dad5dd8a149c9792d8f07f31a9575065cca064bd6af44f8750e4"

spec/vulnerabilities/sensitive_data_exposure.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
before do
99
UserFixture.reset_all_users
10-
normal_user.work_info.update_attribute(:SSN, user_ssn)
10+
normal_user.work_info.update(:SSN, user_ssn)
1111

1212
pending unless verifying_fixed?
1313
end

spec/vulnerabilities/sql_injection_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
fill_in "user_password_confirmation", with: "hacketyhack"
2323

2424
# this is a hidden field, so cannot use fill_in to access it.
25-
find(:xpath, "//input[@id='user_id']", visible: false).set "8' OR admin='t') --"
25+
find(:xpath, "//input[@id='user_id']", visible: false).set "8' OR 1 == 1) --"
2626
end
2727
click_on "Submit"
2828

0 commit comments

Comments
 (0)