diff --git a/Gemfile b/Gemfile index e894f89..e35222e 100755 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,9 @@ gem 'sqlite3' gem 'foreman' gem 'crack', '0.3.1' +# Pry for Rails, not in dev group in case running via prod/staging @ a training +gem 'pry-rails' + group :development, :mysql do gem 'brakeman' gem 'bundler-audit' diff --git a/Gemfile.lock b/Gemfile.lock index 2322869..89e5527 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -185,6 +185,8 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) + pry-rails (0.3.3) + pry (>= 0.9.10) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) @@ -330,6 +332,7 @@ DEPENDENCIES poltergeist powder pry + pry-rails rack-livereload rails (= 3.2.21) rb-fsevent diff --git a/app/models/user.rb b/app/models/user.rb index 9c5cc7f..21b4fd1 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -77,7 +77,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 71d265d..d842cdd 100755 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -22,7 +22,7 @@ Railsgoat::Application.configure do config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false + 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 | -- |