This sample application is based on https://github.com/OWASP/NodeGoat.git.
Warning: The computer running this application will be vulnerable to attacks, please take appropriate precautions.
You can run NodeGoat locally on any machine with Node.js v10.16.0 installed.
- Place a
contrast_security.yaml
file into the application's root folder. - Run
npm install @contrast/agent
. - Create Mongo DB:
* If using local Mongo DB instance, start mongod.
* Update the
db
property in fileconfig/env/development.js
to reflect your DB setup. (in format:mongodb://localhost:27017/<databasename>
) - Populate MongoDB with seed data required for the app
- Run the
npm run db:seed
to populate the DB with seed data required for the application. Pass the desired environment as argument. If not passed, "development" is the default.
- Run the
- Start the server using
npm start
, the Contrast agent will already be enabled. - Browse the application at http://localhost:4000/NodeGoat/
You can run NodeGoat within a Docker container.
- Place a
contrast_security.yaml
file into the application's root folder. - Build the NodeGoat container image using
docker-compose build
. The Contrast agent is added automatically during the Docker build process. - Run the container using
docker-compose up
, this will start a local mongodb container and the web server together. - Browse the application at http://localhost:4000/NodeGoat/
- 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.
This container includes cypress to run automated tests. These can be run using npm run test-with-contrast
.
You can re-build the docker image by running two scripts in order:
- 1-Build-Docker-Image.sh
- 2-Deploy-Docker-Image-To-Docker-Hub.sh
Code licensed under the Apache License v2.0.