diff --git a/Gemfile b/Gemfile index 9b3796e..b610803 100755 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' #don't upgrade -gem 'rails', '4.0.12' +gem 'rails', '4.0.13' ruby '2.1.5' diff --git a/Gemfile.lock b/Gemfile.lock index 752a1e0..1ade5ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,25 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.12) - actionpack (= 4.0.12) + actionmailer (4.0.13) + actionpack (= 4.0.13) mail (~> 2.5, >= 2.5.4) - actionpack (4.0.12) - activesupport (= 4.0.12) + actionpack (4.0.13) + activesupport (= 4.0.13) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.12) - activesupport (= 4.0.12) + activemodel (4.0.13) + activesupport (= 4.0.13) builder (~> 3.1.0) - activerecord (4.0.12) - activemodel (= 4.0.12) + activerecord (4.0.13) + activemodel (= 4.0.13) activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.12) + activesupport (= 4.0.13) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) - activesupport (4.0.12) + activesupport (4.0.13) i18n (~> 0.6, >= 0.6.9) minitest (~> 4.2) multi_json (~> 1.3) @@ -32,13 +32,13 @@ GEM cucumber (>= 1.1.1) rspec-expectations (>= 2.7.0) bcrypt (3.1.9) - better_errors (2.1.0) + better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - brakeman (2.6.3) + brakeman (3.0.0) erubis (~> 2.6) fastercsv (~> 1.5) haml (>= 3.0, < 5.0) @@ -79,7 +79,7 @@ GEM multi_json (>= 1.7.5, < 2.0) multi_test (>= 0.1.1) daemons (1.1.9) - database_cleaner (1.3.0) + database_cleaner (1.4.0) debug_inspector (0.0.2) diff-lcs (1.2.5) docile (1.1.5) @@ -92,7 +92,7 @@ GEM execjs (2.2.2) fastercsv (1.5.5) ffi (1.9.6) - foreman (0.76.0) + foreman (0.77.0) dotenv (~> 1.0.2) thor (~> 0.19.1) formatador (0.2.5) @@ -103,12 +103,14 @@ GEM trollop (~> 2.0) gherkin (2.12.2) multi_json (~> 1.3) - guard (2.10.5) + guard (2.11.1) formatador (>= 0.2.4) listen (~> 2.7) lumberjack (~> 1.0) nenv (~> 0.1) + notiffany (~> 0.0) pry (>= 0.9.12) + shellany (~> 0.0) thor (>= 0.18.1) guard-brakeman (0.8.3) brakeman (>= 2.1.1) @@ -131,18 +133,18 @@ GEM hitimes (1.2.2) http_parser.rb (0.6.0) i18n (0.7.0) - jquery-fileupload-rails (0.4.1) + jquery-fileupload-rails (0.4.2) actionpack (>= 3.1) railties (>= 3.1) jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.8.1) + json (1.8.2) kgio (2.9.2) launchy (2.4.3) addressable (~> 2.3) libv8 (3.16.14.7) - listen (2.8.4) + listen (2.8.5) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) @@ -169,6 +171,9 @@ GEM nenv (0.1.1) nokogiri (1.6.1) mini_portile (~> 0.5.0) + notiffany (0.0.3) + nenv (~> 0.1) + shellany (~> 0.0) poltergeist (1.5.1) capybara (~> 2.1) cliver (~> 0.3.1) @@ -185,19 +190,19 @@ GEM rack rack-protection (1.5.3) rack - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) - rails (4.0.12) - actionmailer (= 4.0.12) - actionpack (= 4.0.12) - activerecord (= 4.0.12) - activesupport (= 4.0.12) + rails (4.0.13) + actionmailer (= 4.0.13) + actionpack (= 4.0.13) + activerecord (= 4.0.13) + activesupport (= 4.0.13) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.12) + railties (= 4.0.13) sprockets-rails (~> 2.0) - railties (4.0.12) - actionpack (= 4.0.12) - activesupport (= 4.0.12) + railties (4.0.13) + actionpack (= 4.0.13) + activesupport (= 4.0.13) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.13.0) @@ -210,7 +215,7 @@ GEM rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) + rspec-core (2.14.0) rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) @@ -235,6 +240,7 @@ GEM sprockets-rails (>= 2.0, < 4.0) tilt (~> 1.1) sexp_processor (4.4.4) + shellany (0.0.1) simplecov (0.9.1) docile (~> 1.1.0) multi_json (~> 1.0) @@ -279,11 +285,11 @@ GEM hitimes travis-lint (2.0.0) json - trollop (2.0) + trollop (2.1.1) turbolinks (2.5.3) coffee-rails tzinfo (0.3.42) - uglifier (2.6.0) + uglifier (2.7.0) execjs (>= 0.3.0) json (>= 1.8.0) unicorn (4.8.3) @@ -325,7 +331,7 @@ DEPENDENCIES powder pry rack-livereload - rails (= 4.0.12) + rails (= 4.0.13) rb-fsevent rspec-rails (= 2.14.2) sass-rails diff --git a/app/models/user.rb b/app/models/user.rb index 263b56d..9aae72e 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -76,7 +76,11 @@ class User < ActiveRecord::Base def assign_user_id unless @skip_user_id_assign.present? || self.user_id.present? user = User.order("user_id").last - uid = user.user_id.to_i + 1 if user && user.user_id && !(User.exists?(:user_id => "#{user.user_id.to_i + 1}")) + uid = if user && user.user_id && !(User.exists?(:user_id => "#{user.user_id.to_i + 1}")) + user.user_id.to_i + 1 + else + 1 + end self.user_id = uid.to_s if uid end end diff --git a/app/views/layouts/shared/_footer.html.erb b/app/views/layouts/shared/_footer.html.erb index 1c1a443..4bb925f 100755 --- a/app/views/layouts/shared/_footer.html.erb +++ b/app/views/layouts/shared/_footer.html.erb @@ -1,6 +1,6 @@ diff --git a/config/environments/test.rb b/config/environments/test.rb index f63436d..3b1eb20 100755 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -18,8 +18,8 @@ Railsgoat::Application.configure do # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false - # Disable request forgery protection in test environment. - config.action_controller.allow_forgery_protection = false + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = true # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the diff --git a/report.html b/report.html deleted file mode 100644 index c8c5512..0000000 --- a/report.html +++ /dev/null @@ -1,1606 +0,0 @@ - - -
- -| Application Path | -Rails Version | -Brakeman Version | -Report Time | -Checks Performed | -
|---|---|---|---|---|
| /Users/cktricky/tmp/railsgoat | -3.2.11 | -2.6.1 - |
- 2014-07-29 12:41:05 -0500 - 2.412842 seconds - |
- BasicAuth, ContentTag, CrossSiteScripting, DefaultRoutes, Deserialize, DetailedExceptions, DigestDoS, EscapeFunction, Evaluation, Execute, FileAccess, FilterSkipping, ForgerySetting, HeaderDoS, I18nXSS, JRubyXML, JSONParsing, LinkTo, LinkToHref, MailTo, MassAssignment, ModelAttrAccessible, ModelAttributes, ModelSerialize, NestedAttributes, NumberToCurrency, QuoteTableName, Redirect, RegexDoS, Render, RenderDoS, ResponseSplitting, SQL, SQLCVEs, SSLVerify, SafeBufferManipulation, SanitizeMethods, SelectTag, SelectVulnerability, Send, SendFile, SessionSettings, SimpleFormat, SingleQuotes, SkipBeforeFilter, StripTags, SymbolDoS, TranslateBug, UnsafeReflection, ValidationRegex, WithoutProtection, YAMLParsing | -
| Scanned/Reported | -Total | -
|---|---|
| Controllers | -17 | -
| Models | -11 | -
| Templates | -73 | -
| Errors | -0 | -
| Security Warnings | -27 (16) | -
| Ignored Warnings | -0 | -
| Warning Type | -Total | -
|---|---|
| Attribute Restriction | -1 | -
| Command Injection | -1 | -
| Cross Site Scripting | -5 | -
| Cross-Site Request Forgery | -1 | -
| Denial of Service | -2 | -
| File Access | -1 | -
| Format Validation | -1 | -
| Mass Assignment | -5 | -
| Remote Code Execution | -5 | -
| SQL Injection | -3 | -
| Session Setting | -2 | -
| Confidence | -Class | -Method | -Warning Type | -Message | -
|---|---|---|---|---|
| High | -BenefitFormsController | -download | -File Access | -- |
| High | -Api::V1::MobileController | -show | -Remote Code Execution | -- |
| High | -Api::V1::MobileController | -index | -Remote Code Execution | -- |
| High | -BenefitFormsController | -download | -Remote Code Execution | -- |
| High | -- | - | Session Setting | -- |
| High | -- | - | Session Setting | -- |
| High | -UsersController | -update | -SQL Injection | -- |
| High | -- | - | SQL Injection | -Rails 3.2.11 contains a SQL injection vulnerability (CVE-2013-6417). Upgrade to 3.2.16 | -
| Medium | -Benefits | -Benefits.make_backup | -Command Injection | -- |
| Medium | -- | - | Denial of Service | -Rails 3.2.11 has a denial of service vulnerability in ActiveRecord: upgrade to 3.2.13 or patch | -
| Medium | -- | - | Remote Code Execution | -- |
| Medium | -Analytics | -hits_by_ip | -SQL Injection | -- |
| Medium | -PasswordResetsController | -reset_password | -Remote Code Execution | -- |
| Medium | -- | - | Cross Site Scripting | -Rails 3.2.11 has a vulnerability in number helpers (CVE-2014-0081). Upgrade to Rails version 3.2.17 | -
| Medium | -- | - | Denial of Service | -Rails 3.2.11 has a denial of service vulnerability (CVE-2013-6414). Upgrade to Rails version 3.2.16 | -
Controller Warnings
-| Confidence | -Controller | -Warning Type | -Message | -
|---|---|---|---|
| High | -ApplicationController | -Cross-Site Request Forgery | -'protect_from_forgery' should be called in ApplicationController | -
Model Warnings
-| Confidence | -Model | -Warning Type | -Message | -
|---|---|---|---|
| High | -Benefits | -Attribute Restriction | -Mass assignment is not restricted using attr_accessible | -
| High | -User | -Format Validation | -- |
| High | -User | -Mass Assignment | -Potentially dangerous attribute available for mass assignment: :admin | -
| Weak | -KeyManagement | -Mass Assignment | -Potentially dangerous attribute available for mass assignment: :user_id | -
| Weak | -Message | -Mass Assignment | -Potentially dangerous attribute available for mass assignment: :creator_id | -
| Weak | -Message | -Mass Assignment | -Potentially dangerous attribute available for mass assignment: :receiver_id | -
| Weak | -User | -Mass Assignment | -Potentially dangerous attribute available for mass assignment: :user_id | -
View Warnings
-| Confidence | -Template | -Warning Type | -Message | -
|---|---|---|---|
| High | -- - layouts/application (AdminController#dashboard) - - | -Cross Site Scripting | -- |
| High | -- - pay/index (PayController#index) - - | -Cross Site Scripting | -- |
| High | -- - pay/index (PayController#index) - - | -Cross Site Scripting | -- |
| High | -- - pay/index (PayController#index) - - | -Cross Site Scripting | -- |