From 1fe75b49565791a5059f65d9fee947cf67e937b6 Mon Sep 17 00:00:00 2001 From: aabashkin Date: Mon, 21 Nov 2022 16:47:20 +0700 Subject: [PATCH] Dockerization --- Dockerfile | 7 +++++++ README.md | 8 +++++++- build-container-image.sh | 4 ++++ pom.xml | 2 +- tag-push-container-image.sh | 12 ++++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 build-container-image.sh create mode 100644 tag-push-container-image.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9aa65e6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM eclipse-temurin:17-jdk-focal + +COPY target/nosql-injection-vulnapp-mongodb-java-*.jar /app/niva.jar + +WORKDIR /app + +ENTRYPOINT [ "java","-jar", "niva.jar"] \ No newline at end of file diff --git a/README.md b/README.md index b190ebd..fe1024c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@ This edition utilizes MongoDB as the NoSQL database and the official Java driver # Setup +## Docker +``` +docker pull aabashkin/niva +docker run -p 8080:8080 aabashkin/niva +``` + ## Maven ``` @@ -59,7 +65,7 @@ The app uses Basic Authentication. Three users are hardcoded: # Testing Tests are located in the root of the web application: -`http://localhost:8080/niva/` +`http://localhost:8080/` The testing page contains a number of links to both secure and insecure endpoints, with options for both regular expected input as well as an example attack vector: diff --git a/build-container-image.sh b/build-container-image.sh new file mode 100644 index 0000000..e11716e --- /dev/null +++ b/build-container-image.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +mvn clean install +docker build --tag aabashkin/niva . \ No newline at end of file diff --git a/pom.xml b/pom.xml index c647ce0..d9f45f9 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ aabashkin nosql-injection-vulnapp-mongodb-java - 1.0.0 + 1.1.0 nosql-injection-vulnapp-mongodb-java An app vulnerable to NoSQL injection built with a MongoDB database and the official Java driver diff --git a/tag-push-container-image.sh b/tag-push-container-image.sh new file mode 100644 index 0000000..c224cd2 --- /dev/null +++ b/tag-push-container-image.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ -z "$1" ] +then + echo "Missing tag version" + exit +fi + +docker tag aabashkin/niva aabashkin/niva:$1 + +docker push aabashkin/niva +docker push aabashkin/niva:$1