From 00e0f79c724021c06af811eac2227bd9caa10f4a Mon Sep 17 00:00:00 2001 From: Jeroen Willemsen Date: Tue, 30 Nov 2021 09:10:01 +0100 Subject: [PATCH] Added challenge 12 for #43 and reverted challenge 8 for #37 --- .github/scripts/docker-create-and-push.sh | 3 +- .gitignore | 3 ++ Dockerfile | 1 + README.md | 12 ++--- .../challenges/cloud/Challenge11.java | 9 ++-- .../challenges/docker/Challenge12.java | 54 +++++++++++++++++++ .../challenges/docker/Challenge8.java | 23 +++++++- src/main/resources/application.properties | 1 + .../resources/explanations/challenge12.adoc | 6 +++ .../resources/explanations/challenge8.adoc | 6 ++- src/main/resources/templates/challenge.html | 3 +- src/main/resources/templates/error.html | 1 + src/main/resources/templates/index.html | 2 + src/main/resources/templates/spoil.html | 2 +- .../challenges/docker/Challenge12Test.java | 54 +++++++++++++++++++ src/test/resources/application.properties | 29 +++++----- 16 files changed, 179 insertions(+), 30 deletions(-) create mode 100644 src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge12.java create mode 100644 src/main/resources/explanations/challenge12.adoc create mode 100644 src/test/java/org/owasp/wrongsecrets/challenges/docker/Challenge12Test.java diff --git a/.github/scripts/docker-create-and-push.sh b/.github/scripts/docker-create-and-push.sh index 3bf8e49cb..2ca9e39e1 100755 --- a/.github/scripts/docker-create-and-push.sh +++ b/.github/scripts/docker-create-and-push.sh @@ -9,7 +9,8 @@ fi echo "tag supplied: $1" echo "tag message: $2" echo "buildarg supplied: $3" - +echo "generating challenge 12-data" +openssl rand -base64 32 | tr -d '\n' > yourkey.txt echo "tagging version" git tag -a $1 -m "$2" git push --tags diff --git a/.gitignore b/.gitignore index 3b74a75cd..e172c9487 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ aws/.terraform.tfstate.lock.info # Templated gcp/k8s/secret-volume.yml gcp/k8s/secret-challenge-vault-deployment.yml + +# Challenge 12 ;-) +.github/scripts/yourkey.txt diff --git a/Dockerfile b/Dockerfile index 9a291a4f5..04fdd3b69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,5 @@ RUN echo "$ARG_BASED_PASSWORD" RUN echo "$argBasedPassword" ADD target/wrongsecrets-0.0.2-SNAPSHOT.jar /application.jar +COPY .github/scripts/ /var/tmp/helpers CMD java -jar -Dspring.profiles.active=$(echo ${SPRING_PROFILES_ACTIVE}) application.jar \ No newline at end of file diff --git a/README.md b/README.md index 828fb0c94..b8fde743f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Welcome to the OWASP WrongSecrets p0wnable app. With this app, we have packed various ways of how to not store your secrets. These can help you to realize whether your secret management is ok. The challenge is to find all the different secrets by means of various tools and techniques. -Can you solve all the 11 challenges? +Can you solve all the 12 challenges? ![screenshot.png](screenshot.png) ## Support @@ -13,7 +13,7 @@ Need support? Contact us via [OWASP Slack](https://owasp.slack.com/archives/C02K ## Basic docker exercises -_Can be used for challenges 1-4, 8_ +_Can be used for challenges 1-4, 8, 12_ For the basic docker exercises you currently require: @@ -33,7 +33,7 @@ Now you can try to find the secrets by means of solving the challenge offered at - [localhost:8080/challenge/3](http://localhost:8080/challenge/3) - [localhost:8080/challenge/4](http://localhost:8080/challenge/4) - [localhost:8080/challenge/8](http://localhost:8080/challenge/8) - +- [localhost:8080/challenge/12](http://localhost:8080/challenge/12) Note that these challenges are still very basic, and so are their explanations. Feel free to file a PR to make them look better ;-). ### Running these on Heroku @@ -50,7 +50,7 @@ You can test them out at Challenge 9 Challenge 10 Challenge 11 + Challenge 12