Merge branch 'pr-136'

This commit is contained in:
cktricky
2014-07-11 06:28:54 -04:00
105 changed files with 3192 additions and 3288 deletions
+7 -2
View File
@@ -1,4 +1,9 @@
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then if [ -f "${rvm_path}/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm" source "${rvm_path}/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc" source ".rvmrc"
elif [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
fi
fi fi
+1
View File
@@ -0,0 +1 @@
railsgoat
+1
View File
@@ -0,0 +1 @@
2.1.2
-1
View File
@@ -1 +0,0 @@
rvm use 2.1.2@railsgoat --create
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013 The Open Web Application Security Project Copyright (c) 2013-2014 The Open Web Application Security Project
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+4 -22
View File
@@ -4,13 +4,10 @@ RailsGoat is a vulnerable version of the Ruby on Rails Framework. It includes vu
## Getting Started ## Getting Started
To begin, install the Ruby Version Manager (RVM): To begin, install the Ruby Version Manager (RVM):
``` ```
$ curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=1.9.3 $ curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=2.1.2
$ rvm use 2.1.2@railsgoat --create # https://rvm.io/
``` ```
After installing the package, clone this repo: After installing the package, clone this repo:
@@ -19,22 +16,7 @@ After installing the package, clone this repo:
$ git clone git@github.com:OWASP/railsgoat.git $ git clone git@github.com:OWASP/railsgoat.git
``` ```
Navigate into the directory and accept the notice by typing `yes`: Navigate into the directory and install the dependencies:
```
****************************************************************************************************
* NOTICE *
****************************************************************************************************
* RVM has encountered a new or modified .rvmrc file in the current directory, this is a shell *
* script and therefore may contain any shell commands. *
* *
* Examine the contents of this file carefully to be sure the contents are safe before trusting it! *
* Do you wish to trust '/path/to/railsgoat/.rvmrc'? *
* Choose v[view] below to view the contents *
****************************************************************************************************
y[es], n[o], v[iew], c[cancel]>
```
Install the project dependencies:
``` ```
$ bundle install $ bundle install
@@ -52,7 +34,7 @@ Initialize the database:
$ rake db:setup $ rake db:setup
``` ```
Start the WEBrick HTTP Server: Start the Thin web server:
``` ```
$ rails server $ rails server
@@ -101,7 +83,7 @@ Conversion to the OWASP Top Ten 2013 completed in November, 2013.
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013 The Open Web Application Security Project Copyright (c) 2013-2014 The Open Web Application Security Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-2
View File
@@ -1,5 +1,4 @@
class AdminController < ApplicationController class AdminController < ApplicationController
before_filter :administrative, :if => :admin_param before_filter :administrative, :if => :admin_param
skip_before_filter :has_info skip_before_filter :has_info
@@ -67,5 +66,4 @@ class AdminController < ApplicationController
def admin_param def admin_param
params[:admin_id] != '1' params[:admin_id] != '1'
end end
end end
@@ -1,5 +1,4 @@
class Api::V1::MobileController < ApplicationController class Api::V1::MobileController < ApplicationController
skip_before_filter :authenticated skip_before_filter :authenticated
before_filter :mobile_request? before_filter :mobile_request?
@@ -30,5 +29,4 @@ class Api::V1::MobileController < ApplicationController
request.user_agent =~ /ios|android/i request.user_agent =~ /ios|android/i
end end
end end
end end
@@ -1,5 +1,4 @@
class Api::V1::UsersController < ApplicationController class Api::V1::UsersController < ApplicationController
skip_before_filter :authenticated skip_before_filter :authenticated
before_filter :valid_api_token before_filter :valid_api_token
before_filter :extrapolate_user before_filter :extrapolate_user
@@ -10,7 +9,6 @@ class Api::V1::UsersController < ApplicationController
# We removed the .as_json code from the model, just seemed like extra work. # We removed the .as_json code from the model, just seemed like extra work.
# dunno, maybe useful at a later time? # dunno, maybe useful at a later time?
#respond_with @user.admin ? User.all.as_json : @user.as_json #respond_with @user.admin ? User.all.as_json : @user.as_json
respond_with @user.admin ? User.all : @user respond_with @user.admin ? User.all : @user
end end
@@ -53,5 +51,4 @@ private
def extrapolate_user def extrapolate_user
@user = User.find_by_id(@clean_token.split("-").first) @user = User.find_by_id(@clean_token.split("-").first)
end end
end end
@@ -1,5 +1,4 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
before_filter :authenticated, :has_info, :create_analytic before_filter :authenticated, :has_info, :create_analytic
helper_method :current_user, :is_admin?, :sanitize_font helper_method :current_user, :is_admin?, :sanitize_font
@@ -53,5 +52,4 @@ class ApplicationController < ActionController::Base
css css
# css if css.match(/\A[0-9]+([\%]|pt)\z/) # css if css.match(/\A[0-9]+([\%]|pt)\z/)
end end
end end
@@ -4,7 +4,6 @@ class BenefitFormsController < ApplicationController
@benefits = Benefits.new @benefits = Benefits.new
end end
def download def download
begin begin
path = params[:name] path = params[:name]
@@ -26,7 +25,6 @@ class BenefitFormsController < ApplicationController
redirect_to user_benefit_forms_path(:user_id => current_user.user_id) redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
end end
=begin =begin
# More secure version # More secure version
def download def download
@@ -47,6 +45,4 @@ class BenefitFormsController < ApplicationController
end end
end end
=end =end
end end
-2
View File
@@ -1,5 +1,4 @@
class DashboardController < ApplicationController class DashboardController < ApplicationController
skip_before_filter :has_info skip_before_filter :has_info
def home def home
@@ -10,5 +9,4 @@ class DashboardController < ApplicationController
cookies[:font] = params[:font] cookies[:font] = params[:font]
end end
end end
end end
-1
View File
@@ -33,5 +33,4 @@ class MessagesController < ApplicationController
end end
end end
end end
end end
@@ -1,7 +1,6 @@
class PasswordResetsController < ApplicationController class PasswordResetsController < ApplicationController
skip_before_filter :authenticated skip_before_filter :authenticated
def reset_password def reset_password
user = Marshal.load(Base64.decode64(params[:user])) unless params[:user].nil? user = Marshal.load(Base64.decode64(params[:user])) unless params[:user].nil?
-1
View File
@@ -39,5 +39,4 @@ class PayController < ApplicationController
format.json {render :json => {:account_num => decrypted || "No Data" }} format.json {render :json => {:account_num => decrypted || "No Data" }}
end end
end end
end end
@@ -3,5 +3,4 @@ class PerformanceController < ApplicationController
def index def index
@perf = current_user.performance @perf = current_user.performance
end end
end end
-1
View File
@@ -3,5 +3,4 @@ class RetirementController < ApplicationController
def index def index
@info = current_user.retirement @info = current_user.retirement
end end
end end
+1 -1
View File
@@ -1,4 +1,5 @@
class ScheduleController < ApplicationController class ScheduleController < ApplicationController
def create def create
message = false message = false
@@ -55,5 +56,4 @@ class ScheduleController < ApplicationController
end end
return vals return vals
end end
end end
-2
View File
@@ -1,5 +1,4 @@
class SessionsController < ApplicationController class SessionsController < ApplicationController
skip_before_filter :has_info skip_before_filter :has_info
skip_before_filter :authenticated, :only => [:new, :create] skip_before_filter :authenticated, :only => [:new, :create]
@@ -37,5 +36,4 @@ class SessionsController < ApplicationController
reset_session reset_session
redirect_to root_path redirect_to root_path
end end
end end
-2
View File
@@ -1,5 +1,4 @@
class TutorialsController < ApplicationController class TutorialsController < ApplicationController
skip_before_filter :has_info skip_before_filter :has_info
skip_before_filter :authenticated skip_before_filter :authenticated
@@ -95,5 +94,4 @@ class TutorialsController < ApplicationController
def metaprogramming def metaprogramming
end end
end end
-3
View File
@@ -1,9 +1,7 @@
class UsersController < ApplicationController class UsersController < ApplicationController
skip_before_filter :has_info skip_before_filter :has_info
skip_before_filter :authenticated, :only => [:new, :create] skip_before_filter :authenticated, :only => [:new, :create]
def new def new
@user = User.new @user = User.new
end end
@@ -52,5 +50,4 @@ class UsersController < ApplicationController
redirect_to user_account_settings_path(:user_id => current_user.user_id) redirect_to user_account_settings_path(:user_id => current_user.user_id)
end end
end end
end end
-2
View File
@@ -1,5 +1,4 @@
class WorkInfoController < ApplicationController class WorkInfoController < ApplicationController
def index def index
@user = User.find_by_user_id(params[:user_id]) @user = User.find_by_user_id(params[:user_id])
if !(@user) || @user.admin if !(@user) || @user.admin
@@ -18,5 +17,4 @@ class WorkInfoController < ApplicationController
end end
end end
=end =end
end end
View File
View File
-1
View File
@@ -34,5 +34,4 @@ class Benefits < ActiveRecord::Base
stream.reopen(on_hold[i]) stream.reopen(on_hold[i])
end end
end end
end end
-1
View File
@@ -2,5 +2,4 @@ class KeyManagement < ActiveRecord::Base
attr_accessible :iv, :user_id attr_accessible :iv, :user_id
belongs_to :work_info belongs_to :work_info
belongs_to :user belongs_to :user
end end
-1
View File
@@ -14,5 +14,4 @@ class PaidTimeOff < ActiveRecord::Base
def sick_days_taken_percentage def sick_days_taken_percentage
result = self.sick_days_taken.to_f / self.sick_days_earned.to_f * 100.0 result = self.sick_days_taken.to_f / self.sick_days_earned.to_f * 100.0
end end
end end
-2
View File
@@ -1,5 +1,4 @@
class Pay < ActiveRecord::Base class Pay < ActiveRecord::Base
# mass-assignable attributes # mass-assignable attributes
attr_accessible :bank_account_num, :bank_routing_num, :percent_of_deposit attr_accessible :bank_account_num, :bank_routing_num, :percent_of_deposit
@@ -21,5 +20,4 @@ class Pay < ActiveRecord::Base
def encrypt_bank_account_num def encrypt_bank_account_num
self.bank_account_num = Encryption.encrypt_sensitive_value(self.bank_account_num) self.bank_account_num = Encryption.encrypt_sensitive_value(self.bank_account_num)
end end
end end
-2
View File
@@ -1,7 +1,6 @@
require 'encryption' require 'encryption'
class User < ActiveRecord::Base class User < ActiveRecord::Base
attr_accessible :email, :admin, :first_name, :last_name, :user_id, :password, :password_confirmation attr_accessible :email, :admin, :first_name, :last_name, :user_id, :password, :password_confirmation
validates :password, :presence => true, validates :password, :presence => true,
:confirmation => true, :confirmation => true,
@@ -96,5 +95,4 @@ private
self[column] = Encryption.encrypt_sensitive_value(self.user_id) self[column] = Encryption.encrypt_sensitive_value(self.user_id)
end while User.exists?(column => self[column]) end while User.exists?(column => self[column])
end end
end end
-2
View File
@@ -4,7 +4,6 @@ class WorkInfo < ActiveRecord::Base
has_one :key_management, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy has_one :key_management, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
#before_save :encrypt_ssn #before_save :encrypt_ssn
# We should probably use this # We should probably use this
def last_four def last_four
"***-**-" << self.decrypt_ssn[-4,4] "***-**-" << self.decrypt_ssn[-4,4]
@@ -40,5 +39,4 @@ class WorkInfo < ActiveRecord::Base
def cipher_type def cipher_type
'aes-256-cbc' 'aes-256-cbc'
end end
end end
+8 -18
View File
@@ -3,51 +3,41 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<div id="success" style="display: none;" class="alert alert-block alert-success fade in"> <div id="success" style="display: none;" class="alert alert-block alert-success fade in">
<h4 class="alert-heading"> <h4 class="alert-heading">Success!</h4>
Success! <p>User information successfully updated.</p>
</h4>
<p>
User information successfully updated.
</p>
</div> </div>
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<div id="failure" style="display: none;" class="alert alert-block alert-error fade in"> <div id="failure" style="display: none;" class="alert alert-block alert-error fade in">
<h4 class="alert-heading"> <h4 class="alert-heading">Error!</h4>
Error! <p>Something went wrong.</p>
</h4>
<p>
Something went wrong.
</p>
</div> </div>
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<div class="widget"> <div class="widget">
<div class="widget-header"> <div class="widget-header">
<div class="title"> <div class="title">
<span class="fs1" aria-hidden="true" data-icon="&#xe071;"></span> <span class="fs1" aria-hidden="true" data-icon="&#xe071;"></span>Manage Users
Manage Users
</div> </div>
</div> </div>
<div id="userDataTable" class="widget-body">
<div id="userDataTable" class="widget-body">
</div> <!-- End widget-body--> </div> <!-- End widget-body-->
</div> <!-- End widget header--> </div> <!-- End widget header-->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<%= javascript_include_tag "jquery.dataTables.js"%> <%= javascript_include_tag "jquery.dataTables.js"%>
<script type="text/javascript"> <script type="text/javascript">
function dataTablePagination(){ function dataTablePagination(){
$('#data-table').dataTable({ $('#data-table').dataTable({
"sPaginationType": "full_numbers" "sPaginationType": "full_numbers"
+1 -9
View File
@@ -110,25 +110,17 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("#benefits_upload").change(function (){ $("#benefits_upload").change(function (){
var fileName = $(this).val(); var fileName = $(this).val();
$(".filename").html(fileName); $(".filename").html(fileName);
}); });
}); });
function makeActive(){ function makeActive(){
$('li[id="benefit_forms"]').addClass('active'); $('li[id="benefit_forms"]').addClass('active');
}; };
$(document).ready( $(document).ready(makeActive);
makeActive
);
</script> </script>
-5
View File
@@ -1,7 +1,5 @@
<div class="dashboard-wrapper"> <div class="dashboard-wrapper">
<div class="main-container"> <div class="main-container">
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <!--begin span12 --> <div class="span12"> <!--begin span12 -->
<% if @user.paid_time_off %> <% if @user.paid_time_off %>
@@ -14,7 +12,6 @@
<script type="text/javascript"> <script type="text/javascript">
function makeActive(){ function makeActive(){
$('li[id="home"]').addClass('active'); $('li[id="home"]').addClass('active');
}; };
@@ -132,7 +129,6 @@ function pieChartHome() {
}, 41000); }, 41000);
}); });
$(function () { $(function () {
//create instance //create instance
$('.chart5').easyPieChart({ $('.chart5').easyPieChart({
@@ -167,6 +163,5 @@ $(document).ready(
makeActive, makeActive,
pieChartHome() pieChartHome()
); );
</script> </script>
@@ -41,6 +41,5 @@ function dataTablePagination(){
}); });
}; };
$(document).ready(dataTablePagination()); $(document).ready(dataTablePagination());
</script> </script>
@@ -56,6 +56,5 @@ function dataTablePagination(){
}); });
}; };
$(document).ready(dataTablePagination()); $(document).ready(dataTablePagination());
</script> </script>
@@ -1,7 +1,4 @@
<!-- Begin Modal --> <!-- Begin Modal -->
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
× ×
@@ -1,5 +1,4 @@
<header> <header>
<span style="color:#eee;margin-left:10px;"> <span style="color:#eee;margin-left:10px;">
Font Size: Font Size:
<a href="<%= home_dashboard_index_path %>?font=8pt" style="font-size:10pt;color:#eee;">A</a> <a href="<%= home_dashboard_index_path %>?font=8pt" style="font-size:10pt;color:#eee;">A</a>
-1
View File
@@ -10,7 +10,6 @@
</script> </script>
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
-1
View File
@@ -51,7 +51,6 @@
<script type="text/javascript"> <script type="text/javascript">
google.load("visualization", "1", { google.load("visualization", "1", {
packages: ["corechart"] packages: ["corechart"]
}); });
-2
View File
@@ -45,8 +45,6 @@
</span> </span>
<div class="clearfix"></div> <div class="clearfix"></div>
<% end %> <% end %>
</div> </div>
-2
View File
@@ -24,8 +24,6 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function openSub(){ function openSub(){
-2
View File
@@ -16,8 +16,6 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function openSub(){ function openSub(){
-1
View File
@@ -74,7 +74,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -101,7 +101,3 @@ $("#submit_button").click(function(event) {
}); });
</script> </script>
-2
View File
@@ -1,7 +1,6 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<div class="row-fluid"> <div class="row-fluid">
<div class="span4 offset4"> <div class="span4 offset4">
<div class="signup"> <div class="signup">
@@ -37,7 +36,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
-2
View File
@@ -52,12 +52,10 @@ function maskSSN(){
} }
function makeActive(){ function makeActive(){
$('li[id="employee_info"]').addClass('active'); $('li[id="employee_info"]').addClass('active');
}; };
$(document).ready(function () { $(document).ready(function () {
maskSSN(), maskSSN(),
makeActive() makeActive()
View File
View File
View File
View File