From c0ea2c87a56aa4809ed212dc1d355d23c9e52237 Mon Sep 17 00:00:00 2001 From: Mike McCabe Date: Thu, 17 Apr 2014 23:03:46 -0400 Subject: [PATCH] adding mysql environment for mysql sql injection tests --- Gemfile | 8 ++++-- Gemfile.lock | 2 ++ config/database.yml | 9 ++++++ config/environments/mysql.rb | 54 ++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100755 config/environments/mysql.rb diff --git a/Gemfile b/Gemfile index c939fa8..57e09c6 100755 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ ruby '2.0.0' gem 'sqlite3' gem 'foreman' -group :development do +group :development, :mysql do gem 'brakeman' gem 'bundler-audit' gem 'guard-brakeman' @@ -33,7 +33,7 @@ gem 'gauntlt' gem 'simplecov', :require => false, :group => :test -group :development, :test do +group :development, :test, :mysql do gem 'launchy' gem 'capybara' gem 'database_cleaner' @@ -41,6 +41,10 @@ group :development, :test do gem 'rspec-rails' end +group :mysql do + gem 'mysql2' +end + # Gems used only for assets and not required # in production environments by default. group :assets do diff --git a/Gemfile.lock b/Gemfile.lock index f22e9ae..c8da373 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -170,6 +170,7 @@ GEM mini_portile (0.5.3) multi_json (1.9.2) multi_test (0.1.1) + mysql2 (0.3.15) nio4r (1.0.0) nokogiri (1.6.1) mini_portile (~> 0.5.0) @@ -324,6 +325,7 @@ DEPENDENCIES jquery-rails launchy mailcatcher + mysql2 poltergeist powder pry diff --git a/config/database.yml b/config/database.yml index 51a4dd4..bb84441 100755 --- a/config/database.yml +++ b/config/database.yml @@ -9,6 +9,15 @@ development: pool: 5 timeout: 5000 +mysql: + adapter: mysql2 + database: development_railsgoat + pool: 5 + timeout: 5000 + host: localhost + username: root + password: + # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. diff --git a/config/environments/mysql.rb b/config/environments/mysql.rb new file mode 100755 index 0000000..9ff11cf --- /dev/null +++ b/config/environments/mysql.rb @@ -0,0 +1,54 @@ +Railsgoat::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Tired of caching causing issues + config.middleware.delete Rack::ETag + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true + + # ActionMailer settings for email support + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 } + config.action_mailer.default_url_options = { :host => "localhost:3000" } + + config.middleware.insert_before( + Rack::Lock, Rack::LiveReload, + :min_delay => 500, + :max_delay => 1000, + :port => 35727, + :host => 'railsgoat.dev', + :ignore => [ %r{dont/modify\.html$} ] + ) +end