This is a Ruby demo application, based on https://github.com/OWASP/railsgoat.
Warning: The computer running this application will be vulnerable to attacks, please take appropriate precautions.
You can run RailGoat locally on any machine with Ruby and Rails 5.x installed.
-
Place a
contrast_security.yaml
file into the application's root folder. -
Install the Contrast agent using:
bundle add contrast-agent
bundle install
- Initialize the database:
rails db:setup
- Start the Thin web server:
rails server
- Browse the application at http://localhost:3000
You can run RailsGoat within a Docker container, tested on OSX. The agent is added automatically during the Docker build process.
- Place a
contrast_security.yaml
file into the application's root folder. - Build the RailsGoat container image using
./1-Build-Docker-Image.sh
- Run the container using
docker run \
-v $PWD/contrast_security.yaml:/myapp/contrast_security.yaml \
-e CONTRAST__APPLICATION__NAME=railsgoat \
-p 3000:3000 railsgoat:latest
- Browse the application at http://localhost:3000
- Place a
contrast_security.yaml
file into the application's root folder. - Install Terraform from here: https://www.terraform.io/downloads.html.
- Install PyYAML using
pip install PyYAML
. - Install the Azure cli tools using
brew update && brew install azure-cli
. - Log into Azure to make sure you cache your credentials using
az login
. - Edit the variables.tf file (or add a terraform.tfvars) to add your initials, preferred Azure location, app name, server name and environment.
- Run
terraform init
to download the required plugins. - Run
terraform plan
and check the output for errors. - Run
terraform apply
to build the infrastructure that you need in Azure, this will output the web address for the application. - Run
terraform destroy
when you would like to stop the app service and release the resources.
RailsGoat includes a set of failing Capybara RSpecs, each one indicating that a separate vulnerability exists in the application. To run them, you first need to install PhantomJS (version 2.1.1 has been tested in Dev and on Travis CI), which is required by the Poltergeist Capybara driver. Upon installation, simply run the following task:
rails training
For Docker run:
docker run \
-v $PWD/contrast_security.yaml:/myapp/contrast_security.yaml \
-e CONTRAST__APPLICATION__NAME=railsgoat \
-e TEST=true \
-p 3000:3000 railsgoat:latest
You can re-build the docker image (used by Terraform) by running two scripts in order:
- 1-Build-Docker-Image.sh
- 2-Deploy-Docker-Image-To-Docker-Hub.sh