Compare commits
209 Commits
Author | SHA1 | Date | |
---|---|---|---|
386ebfe142 | |||
ee31633822 | |||
4018212304 | |||
833e09fced | |||
f1f5c352df | |||
e58373ffff | |||
ae02d98d37 | |||
3b55ef5ffe | |||
705ec85f35 | |||
1f1fb73f86 | |||
e169650ebc | |||
2589aa3fa4 | |||
51c007c545 | |||
5089c107ba | |||
69a93f30d2 | |||
80e01d680b | |||
0658fcefcd | |||
d41d21b2e6 | |||
939f860ddd | |||
d047c41e86 | |||
8dd66fc0ff | |||
d496c929b3 | |||
f8dda37027 | |||
48fd7f310e | |||
5107e111bf | |||
dd2e9f074d | |||
ec954046db | |||
6be9635f51 | |||
f7dd69e382 | |||
fc6b0f28df | |||
f13632578d | |||
b23b428763 | |||
32a41debad | |||
fafddda82a | |||
5bf33db78f | |||
20d7015dff | |||
2fbc52e6a2 | |||
ab0433bb67 | |||
f2f7f36a6d | |||
3ad51e6d6b | |||
9e6ed11aa7 | |||
2bd6b36210 | |||
bcaf4485c2 | |||
cd2e1c1c09 | |||
22af35a9a7 | |||
c7e04cef97 | |||
fa2769cb25 | |||
1a64fcd8d4 | |||
36bdd9b1a0 | |||
6a875bdaa6 | |||
6a92f651f8 | |||
ad97e2c9a3 | |||
e709a501cb | |||
76af488d16 | |||
981fcb3ebc | |||
cc0d0fa2a6 | |||
a4104fdf8b | |||
720414eba6 | |||
541c424eb9 | |||
be2a6aa0bd | |||
e5ab24a1fc | |||
b0174a6b26 | |||
cb8739ac06 | |||
cb6c8af3bb | |||
672d752e0e | |||
8241d98a38 | |||
86d3868d9e | |||
2f007babec | |||
7742444a99 | |||
98bcef9a5e | |||
c3f9772a27 | |||
01d3453c41 | |||
eb163c8df1 | |||
ff67ee6484 | |||
ccdede647b | |||
4b32cc36a7 | |||
9e15e95001 | |||
dc71975f27 | |||
b79a9c6b2c | |||
a7b9954d0f | |||
dfa0e1cdca | |||
8e6d87d429 | |||
5adf1d1dd7 | |||
5164514789 | |||
f28bb09724 | |||
7602781a5b | |||
b6dff3f32b | |||
360cdc7239 | |||
74ca2ff12a | |||
fbf18440fb | |||
b7a1edd04a | |||
14bb53d43a | |||
906ab766df | |||
902af04dd4 | |||
05bef55c80 | |||
5933d226af | |||
b7ff89243a | |||
835104c88f | |||
246b4de1b8 | |||
49109154a8 | |||
efca784acf | |||
14a6efedf3 | |||
ef4b7ce1a7 | |||
68a69e9b07 | |||
93265a3686 | |||
ae87f7eb49 | |||
38bae09f82 | |||
75b63ea179 | |||
dd89e56f6e | |||
2cb9c52a7a | |||
e89a59b053 | |||
40456f25b9 | |||
f5604df256 | |||
32bd895632 | |||
ffe400cb76 | |||
897afa3c2b | |||
96ec4aa909 | |||
a1796f2577 | |||
362248a065 | |||
9403bbb851 | |||
0c285eef5b | |||
1461263b60 | |||
61f2bfa9ec | |||
04d1293a33 | |||
9af514f3eb | |||
8e567b0f86 | |||
a4218b0016 | |||
42369816c9 | |||
3492655f1d | |||
e75cfbeb11 | |||
7ec6826abc | |||
825193bbb5 | |||
a14e84d5c5 | |||
14ab2faeaf | |||
8e47eac263 | |||
6aaa743302 | |||
0e08c4bde0 | |||
f7871942da | |||
c8fad66973 | |||
9cc0ae5c38 | |||
9a37a27a3c | |||
453a09e0b4 | |||
d566080a79 | |||
4ce098f39b | |||
f22e4f55c1 | |||
15ea31a4df | |||
032b90d483 | |||
a050fa9669 | |||
60bd04b9aa | |||
91af9a0ef7 | |||
486b81f8ec | |||
eed0feed06 | |||
e9df66ca1f | |||
1381daf06e | |||
ac542ad8b8 | |||
a2677cee58 | |||
a641a19615 | |||
a91d45dea5 | |||
81c551552b | |||
69a370f438 | |||
3aa791bc1b | |||
a53ba0af5c | |||
a1071e9c00 | |||
70cda80176 | |||
ac0cb3560c | |||
d9712e7589 | |||
cfe763f98d | |||
4869616176 | |||
30abcc0a1a | |||
38f1d52bf3 | |||
e49f5d610f | |||
04d065fd87 | |||
d345a9a716 | |||
2d8d898fb7 | |||
ad9ee094b4 | |||
cb2277628c | |||
5869b64ee0 | |||
6ae9e44e84 | |||
d0f36f5227 | |||
5d45fd6260 | |||
b3f7a5338e | |||
b858484b97 | |||
b76330f20f | |||
ee1d4b0ac1 | |||
abf431fffb | |||
3e8dbc9bc9 | |||
721edc9985 | |||
82198424df | |||
ba2cb7d14f | |||
de453fad84 | |||
59c96f9890 | |||
f7d3fd586e | |||
798afc756b | |||
59aaab52a9 | |||
14621003d7 | |||
23f67b3d25 | |||
1c6de07a54 | |||
cda852f4e8 | |||
1d6a5ca01b | |||
c574a6610b | |||
ae6d448aa0 | |||
b8bdb8f432 | |||
3300c47c03 | |||
d077a76063 | |||
43d13dd1f9 | |||
072d99040f | |||
4d5968da1a | |||
5a3843cf1f | |||
5fd0f03fd4 |
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
max_line_length = 120
|
||||||
|
tab_width = 4
|
||||||
|
ij_continuation_indent_size = 8
|
||||||
|
ij_formatter_off_tag = @formatter:off
|
||||||
|
ij_formatter_on_tag = @formatter:on
|
||||||
|
ij_formatter_tags_enabled = false
|
||||||
|
ij_wrap_on_typing = true
|
||||||
|
ij_java_names_count_to_use_import_on_demand = 999
|
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
custom: https://owasp.org/donate/?reponame=www-project-webgoat&title=OWASP+WebGoat
|
10
.github/lock.yml
vendored
Normal file
10
.github/lock.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
daysUntilLock: 365
|
||||||
|
skipCreatedBefore: false
|
||||||
|
exemptLabels: []
|
||||||
|
lockLabel: false
|
||||||
|
lockComment: >
|
||||||
|
This thread has been automatically locked because it has not had
|
||||||
|
recent activity after it was closed. :lock: Please open a new issue
|
||||||
|
for regressions or related bugs.
|
||||||
|
setLockReason: false
|
10
.github/stale.yml
vendored
Normal file
10
.github/stale.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
daysUntilStale: 90
|
||||||
|
daysUntilClose: 14
|
||||||
|
onlyLabels:
|
||||||
|
- waiting-for-input
|
||||||
|
- wontfix
|
||||||
|
staleLabel: stale
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as `stale` because it has not had recent activity. :calendar: It will be _closed automatically_ in one week if no further activity occurs.
|
||||||
|
closeComment: false
|
54
.github/workflows/branch_build.yml
vendored
Normal file
54
.github/workflows/branch_build.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
name: "Branch build"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
- release/*
|
||||||
|
jobs:
|
||||||
|
install-notest:
|
||||||
|
if: "github.repository != 'WebGoat/WebGoat'"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: "Package and linting"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: set up JDK 17
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: 17
|
||||||
|
architecture: x64
|
||||||
|
- name: Cache Maven packages
|
||||||
|
uses: actions/cache@v2.1.7
|
||||||
|
with:
|
||||||
|
path: ~/.m2
|
||||||
|
key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: ubuntu-latest-m2
|
||||||
|
- name: Test with Maven
|
||||||
|
run: mvn install -DskipTests
|
||||||
|
|
||||||
|
testing:
|
||||||
|
if: "github.repository != 'WebGoat/WebGoat'"
|
||||||
|
needs: install-notest
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
args:
|
||||||
|
- mvn -pl '!webgoat-integration-tests' test
|
||||||
|
- mvn -pl webgoat-integration-tests test
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: set up JDK 17
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: 17
|
||||||
|
architecture: x64
|
||||||
|
- name: Cache Maven packages
|
||||||
|
uses: actions/cache@v2.1.7
|
||||||
|
with:
|
||||||
|
path: ~/.m2
|
||||||
|
key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: ubuntu-latest-m2
|
||||||
|
- name: Test with Maven
|
||||||
|
run: ${{ matrix.args }}
|
@ -1,9 +1,24 @@
|
|||||||
name: "Build"
|
name: "Pull request build"
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '.txt'
|
||||||
|
- '*.MD'
|
||||||
|
- '*.md'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'docs/**'
|
||||||
push:
|
push:
|
||||||
branches: [ '*' ]
|
branches:
|
||||||
|
- main
|
||||||
|
- release/*
|
||||||
tags-ignore:
|
tags-ignore:
|
||||||
- '*'
|
- '*'
|
||||||
|
paths-ignore:
|
||||||
|
- '.txt'
|
||||||
|
- '*.MD'
|
||||||
|
- '*.md'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'docs/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -11,31 +26,20 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
java: [11, 15]
|
java: [17]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK ${{ matrix.java }}
|
- name: Set up JDK ${{ matrix.java }}
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- name: Cache Maven packages
|
- name: Cache Maven packages
|
||||||
uses: actions/cache@v2.1.4
|
uses: actions/cache@v2.1.7
|
||||||
with:
|
with:
|
||||||
path: ~/.m2
|
path: ~/.m2
|
||||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: ${{ runner.os }}-m2
|
restore-keys: ${{ runner.os }}-m2
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn clean install
|
run: mvn package
|
||||||
|
|
||||||
notify-slack:
|
|
||||||
if: github.event_name == 'push' && (success() || failure())
|
|
||||||
needs:
|
|
||||||
- build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Slack workflow notification"
|
|
||||||
uses: Gamesight/slack-workflow-status@master
|
|
||||||
with:
|
|
||||||
repo_token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
|
|
19
.github/workflows/rebase.yml
vendored
19
.github/workflows/rebase.yml
vendored
@ -1,19 +0,0 @@
|
|||||||
name: "Automatic Rebase"
|
|
||||||
on:
|
|
||||||
issue_comment:
|
|
||||||
types: [created]
|
|
||||||
jobs:
|
|
||||||
rebase:
|
|
||||||
name: Rebase
|
|
||||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'MEMBER'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout the latest code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
|
||||||
- name: Automatic Rebase
|
|
||||||
uses: cirrus-actions/rebase@1.4
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
217
.github/workflows/release.yml
vendored
217
.github/workflows/release.yml
vendored
@ -4,110 +4,122 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
jobs:
|
jobs:
|
||||||
# release:
|
release:
|
||||||
# name: Release WebGoat
|
if: github.repository == 'WebGoat/WebGoat'
|
||||||
# runs-on: ubuntu-latest
|
name: Release WebGoat
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v2
|
|
||||||
#
|
|
||||||
# - name: "Get tag name"
|
|
||||||
# id: tag
|
|
||||||
# uses: dawidd6/action-get-tag@v1
|
|
||||||
#
|
|
||||||
# - name: Set up JDK 11
|
|
||||||
# uses: actions/setup-java@v1
|
|
||||||
# with:
|
|
||||||
# java-version: 11
|
|
||||||
# architecture: x64
|
|
||||||
#
|
|
||||||
# - name: Cache Maven packages
|
|
||||||
# uses: actions/cache@v2.1.4
|
|
||||||
# with:
|
|
||||||
# path: ~/.m2
|
|
||||||
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
||||||
# restore-keys: ${{ runner.os }}-m2
|
|
||||||
#
|
|
||||||
# - name: "Set labels for ${{ github.ref }}"
|
|
||||||
# run: |
|
|
||||||
# echo "WEBGOAT_TAG_VERSION=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV
|
|
||||||
# WEBGOAT_MAVEN_VERSION=${{ steps.tag.outputs.tag }}
|
|
||||||
# echo "WEBGOAT_MAVEN_VERSION=${WEBGOAT_MAVEN_VERSION:1}" >> $GITHUB_ENV
|
|
||||||
# - name: Build with Maven
|
|
||||||
# run: |
|
|
||||||
# mvn versions:set -DnewVersion=${{ env.WEBGOAT_MAVEN_VERSION }}
|
|
||||||
# mvn clean install -DskipTests
|
|
||||||
#
|
|
||||||
# - name: "Create release"
|
|
||||||
# uses: softprops/action-gh-release@v1
|
|
||||||
# with:
|
|
||||||
# draft: false
|
|
||||||
# files: |
|
|
||||||
# webgoat-server/target/webgoat-server-${{ env.WEBGOAT_MAVEN_VERSION }}.jar
|
|
||||||
# webwolf/target/webwolf-${{ env.WEBGOAT_MAVEN_VERSION }}.jar
|
|
||||||
# body: |
|
|
||||||
# ## Version ${{ steps.tag.outputs.tag }}
|
|
||||||
#
|
|
||||||
# ### New functionality
|
|
||||||
#
|
|
||||||
# - test
|
|
||||||
#
|
|
||||||
# ### Bug fixes
|
|
||||||
#
|
|
||||||
# - [#743 - Character encoding errors](https://github.com/WebGoat/WebGoat/issues/743)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# ## Contributors
|
|
||||||
#
|
|
||||||
# Special thanks to the following contributors providing us with a pull request:
|
|
||||||
#
|
|
||||||
# - Person 1
|
|
||||||
# - Person 2
|
|
||||||
#
|
|
||||||
# And everyone who provided feedback through Github.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Team WebGoat
|
|
||||||
# env:
|
|
||||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
#
|
|
||||||
# - name: "Set up QEMU"
|
|
||||||
# uses: docker/setup-qemu-action@v1
|
|
||||||
#
|
|
||||||
# - name: "Set up Docker Buildx"
|
|
||||||
# uses: docker/setup-buildx-action@v1
|
|
||||||
#
|
|
||||||
# - name: "Login to dockerhub"
|
|
||||||
# uses: docker/login-action@v1
|
|
||||||
# with:
|
|
||||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
#
|
|
||||||
# - name: "Build and push"
|
|
||||||
# uses: docker/build-push-action@v2
|
|
||||||
# with:
|
|
||||||
# context: ./docker
|
|
||||||
# file: docker/Dockerfile
|
|
||||||
# push: false #todo enable
|
|
||||||
# platforms: linux/amd64
|
|
||||||
# tags: |
|
|
||||||
# webgoat/goatandwolf:${{ env.WEBGOAT_TAG_VERSION }}
|
|
||||||
# webgoat/goatandwolf:latest
|
|
||||||
# build-args: |
|
|
||||||
# webgoat_version=${{ env.WEBGOAT_MAVEN_VERSION }}
|
|
||||||
#
|
|
||||||
# - name: "Image digest"
|
|
||||||
# run: echo ${{ steps.docker_build.outputs.digest }}
|
|
||||||
new_version:
|
|
||||||
name: Update development version
|
|
||||||
# needs: [ release ]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
- name: Set up JDK 11
|
- name: "Get tag name"
|
||||||
uses: actions/setup-java@v1
|
id: tag
|
||||||
|
uses: dawidd6/action-get-tag@v1
|
||||||
|
|
||||||
|
- name: Set up JDK 15
|
||||||
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
distribution: 'zulu'
|
||||||
|
java-version: 15
|
||||||
|
architecture: x64
|
||||||
|
|
||||||
|
- name: Cache Maven packages
|
||||||
|
uses: actions/cache@v2.1.7
|
||||||
|
with:
|
||||||
|
path: ~/.m2
|
||||||
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: ${{ runner.os }}-m2
|
||||||
|
|
||||||
|
- name: "Set labels for ${{ github.ref }}"
|
||||||
|
run: |
|
||||||
|
echo "WEBGOAT_TAG_VERSION=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV
|
||||||
|
WEBGOAT_MAVEN_VERSION=${{ steps.tag.outputs.tag }}
|
||||||
|
echo "WEBGOAT_MAVEN_VERSION=${WEBGOAT_MAVEN_VERSION:1}" >> $GITHUB_ENV
|
||||||
|
- name: Build with Maven
|
||||||
|
run: |
|
||||||
|
mvn versions:set -DnewVersion=${{ env.WEBGOAT_MAVEN_VERSION }}
|
||||||
|
mvn install -DskipTests
|
||||||
|
|
||||||
|
- name: "Create release"
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
draft: false
|
||||||
|
files: |
|
||||||
|
webgoat-server/target/webgoat-server-${{ env.WEBGOAT_MAVEN_VERSION }}.jar
|
||||||
|
webwolf/target/webwolf-${{ env.WEBGOAT_MAVEN_VERSION }}.jar
|
||||||
|
body: |
|
||||||
|
## Version ${{ steps.tag.outputs.tag }}
|
||||||
|
|
||||||
|
### New functionality
|
||||||
|
|
||||||
|
- test
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- [#743 - Character encoding errors](https://github.com/WebGoat/WebGoat/issues/743)
|
||||||
|
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
Special thanks to the following contributors providing us with a pull request:
|
||||||
|
|
||||||
|
- Person 1
|
||||||
|
- Person 2
|
||||||
|
|
||||||
|
And everyone who provided feedback through Github.
|
||||||
|
|
||||||
|
|
||||||
|
Team WebGoat
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: "Set up QEMU"
|
||||||
|
uses: docker/setup-qemu-action@v1.1.0
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: "Set up Docker Buildx"
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: "Login to dockerhub"
|
||||||
|
uses: docker/login-action@v1.9.0
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: "Build and push"
|
||||||
|
uses: docker/build-push-action@v2.7.0
|
||||||
|
with:
|
||||||
|
context: ./docker
|
||||||
|
file: docker/Dockerfile
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64, linux/arm64, linux/arm/v7
|
||||||
|
tags: |
|
||||||
|
webgoat/goatandwolf:${{ env.WEBGOAT_TAG_VERSION }}
|
||||||
|
webgoat/goatandwolf:latest
|
||||||
|
build-args: |
|
||||||
|
webgoat_version=${{ env.WEBGOAT_MAVEN_VERSION }}
|
||||||
|
|
||||||
|
- name: "Image digest"
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
new_version:
|
||||||
|
if: github.repository == 'WebGoat/WebGoat'
|
||||||
|
name: Update development version
|
||||||
|
needs: [ release ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: release
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.4
|
||||||
|
with:
|
||||||
|
ref: develop
|
||||||
|
token: ${{ secrets.WEBGOAT_DEPLOYER_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up JDK 15
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: 15
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Set version to next snapshot
|
- name: Set version to next snapshot
|
||||||
@ -116,7 +128,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Commit pom.xml
|
- name: Commit pom.xml
|
||||||
run: |
|
run: |
|
||||||
git checkout develop
|
git config user.name webgoat-github
|
||||||
|
git config user.email owasp.webgoat@gmail.com
|
||||||
find . -name 'pom.xml' | xargs git add
|
find . -name 'pom.xml' | xargs git add
|
||||||
git commit -m "Updating to the new development version"
|
git commit -m "Updating to the new development version"
|
||||||
git push origin develop
|
git push
|
||||||
|
8
.github/workflows/welcome.yml
vendored
8
.github/workflows/welcome.yml
vendored
@ -1,12 +1,16 @@
|
|||||||
name: Welcome
|
name: Welcome
|
||||||
|
|
||||||
on: [pull_request, issues]
|
on:
|
||||||
|
issues:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
greeting:
|
greeting:
|
||||||
|
if: github.repository == 'WebGoat/WebGoat'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/first-interaction@v1
|
- uses: actions/first-interaction@v1.1.0
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
issue-message: 'Thanks for submitting your first issue, we will have a look as quickly as possible.'
|
issue-message: 'Thanks for submitting your first issue, we will have a look as quickly as possible.'
|
||||||
|
4
.mvn/wrapper/maven-wrapper.properties
vendored
4
.mvn/wrapper/maven-wrapper.properties
vendored
@ -1,2 +1,2 @@
|
|||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.2.5/apache-maven-3.2.5-bin.zip
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
|
||||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
|
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||||
|
60
CODE_OF_CONDUCT.md
Normal file
60
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment include:
|
||||||
|
|
||||||
|
- Using welcoming and inclusive language
|
||||||
|
- Being respectful of differing viewpoints and experiences
|
||||||
|
- Gracefully accepting constructive criticism
|
||||||
|
- Focusing on what is best for the community
|
||||||
|
- Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||||
|
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
- Public or private harassment
|
||||||
|
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||||
|
- Misusing the context of the WebGoat project for commercial goals (e.g. adding sales pitches to the codebase or to communication channels used by the project, such as Slack).
|
||||||
|
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
|
||||||
|
The WebGoat project and its materials are conceived for educational and research purposes only.
|
||||||
|
|
||||||
|
Refrain from violating the laws in your country by carefully consulting them before executing any tests against web applications or other assets utilizing the WebGoat (or Webwolf) materials.
|
||||||
|
|
||||||
|
The WebGoat project is also NOT supporting unethical activities in any way. If you come across such requests, please reach out to the project leaders and raise this to them.
|
||||||
|
|
||||||
|
Neither OWASP, the WebGoat project leaders, authors or anyone else involved in this project is going to take responsibility for your actions.
|
||||||
|
|
||||||
|
The intention of the WebGoat is not to encourage hacking or malicious activities! Instead, the goal of the project is to learn different hacking techniques and offer ways to reduce or mitigate that risk.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community includes using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at nanne.baars@owasp.org.
|
||||||
|
|
||||||
|
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org "Contributor Covenant homepage"), [version 1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html "Code of Conduct version 1.4").
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see [the Contributor Covenant FAQ](https://www.contributor-covenant.org/faq)
|
98
CONTRIBUTING.md
Normal file
98
CONTRIBUTING.md
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
# Contributing
|
||||||
|
[](https://github.com/WebGoat/WebGoat/graphs/contributors)
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
This document describes how you can contribute to WebGoat. Please read it carefully.
|
||||||
|
|
||||||
|
**Table of Contents**
|
||||||
|
|
||||||
|
* [How to Contribute to the Project](#how-to-contribute-to-the-project)
|
||||||
|
* [How to set up your Contributor Environment](#how-to-set-up-your-contributor-environment)
|
||||||
|
* [How to get your PR Accepted](#how-to-get-your-pr-accepted)
|
||||||
|
|
||||||
|
## How to Contribute to the project
|
||||||
|
|
||||||
|
There are a couple of ways on how you can contribute to the project:
|
||||||
|
|
||||||
|
* **File [issues](https://github.com/WebGoat/WebGoat/issues "Webgoat Issues")** for missing content or errors. Explain what you think is missing and give a suggestion as to where it could be added.
|
||||||
|
* **Create a [pull request (PR)](https://github.com/WebGoat/WebGoat/pulls "Create a pull request")**. This is a direct contribution to the project and may be merged after review. You should ideally [create an issue](https://github.com/WebGoat/WebGoat/issues "WebGoat Issues") for any PR you would like to submit, as we can first review the merit of the PR and avoid any unnecessary work. This is of course not needed for small modifications such as correcting typos.
|
||||||
|
* **Help out financially** by donating via [OWASP donations](https://owasp.org/donate/?reponame=www-project-webgoat&title=OWASP+WebGoat).
|
||||||
|
|
||||||
|
## How to get your PR accepted
|
||||||
|
|
||||||
|
Your PR is valuable to us, and to make sure we can integrate it smoothly, we have a few items for you to consider. In short:
|
||||||
|
The minimum requirements for code contributions are:
|
||||||
|
|
||||||
|
1. The code _must_ be compliant with the configured Checkstyle and PMD rules.
|
||||||
|
2. All new and changed code _should_ have a corresponding unit and/or integration test.
|
||||||
|
3. New and changed lessons _must_ have a corresponding integration test.
|
||||||
|
4. [Status checks](https://docs.github.com/en/github/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks) should pass for your last commit.
|
||||||
|
|
||||||
|
Additionally, the following guidelines can help:
|
||||||
|
|
||||||
|
### Keep your pull requests limited to a single issue
|
||||||
|
|
||||||
|
Pull requests should be as small/atomic as possible. Large, wide-sweeping changes in a pull request will be **rejected**, with comments to isolate the specific code in your pull request. Some examples:
|
||||||
|
|
||||||
|
* If you are making spelling corrections in the docs, don't modify other files.
|
||||||
|
* If you are adding new functions don't '*cleanup*' unrelated functions. That cleanup belongs in another pull request.
|
||||||
|
|
||||||
|
|
||||||
|
### Write a good commit message
|
||||||
|
|
||||||
|
* Explain why you make the changes. [More infos about a good commit message.](https://betterprogramming.pub/stop-writing-bad-commit-messages-8df79517177d)
|
||||||
|
|
||||||
|
* If you fix an issue with your commit, please close the issue by [adding one of the keywords and the issue number](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) to your commit message.
|
||||||
|
|
||||||
|
For example: `Fix #545` or `Closes #10`
|
||||||
|
|
||||||
|
## How to set up your Contributor Environment
|
||||||
|
|
||||||
|
1. Create a GitHub account. Multiple different GitHub subscription plans are available, but you only need a free one. Follow [these steps](https://help.github.com/en/articles/signing-up-for-a-new-github-account "Signing up for a new GitHub account") to set up your account.
|
||||||
|
2. Fork the repository. Creating a fork means creating a copy of the repository on your own account, which you can modify without any impact on this repository. GitHub has an [article that describes all the needed steps](https://help.github.com/en/articles/fork-a-repo "Fork a repo").
|
||||||
|
3. Clone your own repository to your host computer so that you can make modifications. If you followed the GitHub tutorial from step 2, you have already done this.
|
||||||
|
4. Go to the newly cloned directory "WebGoat" and add the remote upstream repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote -v
|
||||||
|
origin git@github.com:<your Github handle>/WebGoat.git (fetch)
|
||||||
|
origin git@github.com:<your Github handle>/WebGoat.git (push)
|
||||||
|
|
||||||
|
$ git remote add upstream git@github.com:WebGoat/WebGoat.git
|
||||||
|
|
||||||
|
$ git remote -v
|
||||||
|
origin git@github.com:<your Github handle>/WebGoat.git (fetch)
|
||||||
|
origin git@github.com:<your Github handle>/WebGoat.git (push)
|
||||||
|
upstream git@github.com:OWASP/WebGoat.git (fetch)
|
||||||
|
upstream git@github.com:OWASP/WebGoat.git (push)
|
||||||
|
```
|
||||||
|
|
||||||
|
See also the GitHub documentation on "[Configuring a remote for a fork](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork "Configuring a remote for a fork")".
|
||||||
|
5. Choose what to work on, based on any of the outstanding [issues](https://github.com/WebGoat/WebGoat/issues "WebGoat Issues").
|
||||||
|
6. Create a branch so that you can cleanly work on the chosen issue: `git checkout -b FixingIssue66`
|
||||||
|
7. Open your favorite editor and start making modifications. We recommend using the [IntelliJ Idea](https://www.jetbrains.com/idea/).
|
||||||
|
8. After your modifications are done, push them to your forked repository. This can be done by executing the command `git add MYFILE` for every file you have modified, followed by `git commit -m 'your commit message here'` to commit the modifications and `git push` to push your modifications to GitHub.
|
||||||
|
9. Create a Pull Request (PR) by going to your fork, <https://github.com/Your_Github_Handle/WebGoat> and click on the "New Pull Request" button. The target branch should typically be the Master branch. When submitting a PR, be sure to follow the checklist that is provided in the PR template. The checklist itself will be filled out by the reviewer.
|
||||||
|
10. Your PR will be reviewed and comments may be given. In order to process a comment, simply make modifications to the same branch as before and push them to your repository. GitHub will automatically detect these changes and add them to your existing PR.
|
||||||
|
11. When starting on a new PR in the future, make sure to always keep your local repo up to date:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git fetch upstream
|
||||||
|
$ git merge upstream/develop
|
||||||
|
```
|
||||||
|
|
||||||
|
See also the following article for further explanation on "[How to Keep a Downstream git Repository Current with Upstream Repository Changes](https://medium.com/sweetmeat/how-to-keep-a-downstream-git-repository-current-with-upstream-repository-changes-10b76fad6d97 "How to Keep a Downstream git Repository Current with Upstream Repository Changes")".
|
||||||
|
|
||||||
|
If at any time you want to work on a different issue, you can simply switch to a different branch, as explained in step 5.
|
||||||
|
|
||||||
|
> Tip: Don't try to work on too many issues at once though, as it will be a lot more difficult to merge branches the longer they are open.
|
||||||
|
|
||||||
|
## What not to do
|
||||||
|
|
||||||
|
Although we greatly appreciate any and all contributions to the project, there are a few things that you should take into consideration:
|
||||||
|
|
||||||
|
* The WebGoat project should not be used as a platform for advertisement for commercial tools, companies or individuals. Write-ups should be written with free and open-source tools in mind and commercial tools are typically not accepted, unless as a reference in the security tools section.
|
||||||
|
* Unnecessary self-promotion of tools or blog posts is frowned upon. If you have a relation with on of the URLs or tools you are referencing, please state so in the PR so that we can verify that the reference is in line with the rest of the guide.
|
||||||
|
|
||||||
|
Please be sure to take a careful look at our [Code of Conduct](https://github.com/WebGoat/WebGoat/blob/master/CODE_OF_CONDUCT.md) for all the details.
|
@ -16,15 +16,14 @@ At the moment we use Gitflow, for a release you create a new release branch and
|
|||||||
```
|
```
|
||||||
git checkout develop
|
git checkout develop
|
||||||
git flow release start <version>
|
git flow release start <version>
|
||||||
mvn versions:set <<version>
|
|
||||||
git commit -am "New release, updating pom.xml"
|
|
||||||
git flow release publish
|
git flow release publish
|
||||||
|
|
||||||
<<Make changes if necessary>>
|
<<Make changes if necessary>>
|
||||||
|
<<Update RELEASE_NOTES.md>>
|
||||||
|
|
||||||
git flow release finish <version>
|
git flow release finish <version>
|
||||||
git push origin develop
|
git push origin develop
|
||||||
git push origin master
|
git push origin main
|
||||||
git push --tags
|
git push --tags
|
||||||
```
|
```
|
||||||
|
|
1
PULL_REQUEST_TEMPLATE.md
Normal file
1
PULL_REQUEST_TEMPLATE.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Thank you for submitting a pull request to the WebGoat!
|
146
README.MD
146
README.MD
@ -1,146 +0,0 @@
|
|||||||
# WebGoat 8: A deliberately insecure Web Application
|
|
||||||
|
|
||||||
[](https://travis-ci.org/WebGoat/WebGoat)
|
|
||||||
[](https://coveralls.io/github/WebGoat/WebGoat?branch=master)
|
|
||||||
[](https://www.codacy.com/app/dm/WebGoat)
|
|
||||||
[](https://www.owasp.org/index.php/OWASP_Project_Inventory#tab=Labs_Projects)
|
|
||||||
[](https://github.com/WebGoat/WebGoat/releases/latest)
|
|
||||||
[](https://gitter.im/OWASPWebGoat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
||||||
|
|
||||||
# Introduction
|
|
||||||
|
|
||||||
WebGoat is a deliberately insecure web application maintained by [OWASP](http://www.owasp.org/) designed to teach web
|
|
||||||
application security lessons.
|
|
||||||
|
|
||||||
This program is a demonstration of common server-side application flaws. The
|
|
||||||
exercises are intended to be used by people to learn about application security and
|
|
||||||
penetration testing techniques.
|
|
||||||
|
|
||||||
**WARNING 1:** *While running this program your machine will be extremely
|
|
||||||
vulnerable to attack. You should disconnect from the Internet while using
|
|
||||||
this program.* WebGoat's default configuration binds to localhost to minimize
|
|
||||||
the exposure.
|
|
||||||
|
|
||||||
**WARNING 2:** *This program is for educational purposes only. If you attempt
|
|
||||||
these techniques without authorization, you are very likely to get caught. If
|
|
||||||
you are caught engaging in unauthorized hacking, most companies will fire you.
|
|
||||||
Claiming that you were doing security research will not work as that is the
|
|
||||||
first thing that all hackers claim.*
|
|
||||||
|
|
||||||
# Installation Instructions:
|
|
||||||
|
|
||||||
## 1. Run using Docker
|
|
||||||
|
|
||||||
Every release is also published on [DockerHub]((https://hub.docker.com/r/webgoat/webgoat-8.0/)).
|
|
||||||
|
|
||||||
### Using docker run
|
|
||||||
|
|
||||||
The easiest way to start WebGoat as a Docker container is to use the all-in-one docker container. This is a docker image that has WebGoat and WebWolf running inside.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker run -p 8080:8080 -p 9090:9090 -e TZ=Europe/Amsterdam webgoat/goatandwolf
|
|
||||||
```
|
|
||||||
|
|
||||||
WebGoat will be located at: http://127.0.0.1:8080/WebGoat
|
|
||||||
WebWolf will be located at: http://127.0.0.1:9090/WebWolf
|
|
||||||
|
|
||||||
**Important**: Choose the correct timezone, so that the docker container and your host are in the same timezone. As it important for the validity of JWT tokens used in certain exercises.
|
|
||||||
|
|
||||||
### Using docker stack deploy
|
|
||||||
|
|
||||||
Another way to deply WebGoat and WebWolf in a more advanced way is to use a compose-file in a docker stack deploy.
|
|
||||||
You can define which containers should run in which combinations and define all of this in a yaml file.
|
|
||||||
An example of such a file is: [goat-with-reverseproxy.yaml](goat-with-reverseproxy.yaml)
|
|
||||||
|
|
||||||
This sets up an nginx webserver as reverse proxy to WebGoat and WebWolf. You can change the timezone by adjusting the value in the yaml file.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker stack init
|
|
||||||
docker stack deploy --compose-file goat-with-reverseproxy.yaml webgoatdemo
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the following entries in your local hosts file:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
127.0.0.1 www.webgoat.local www.webwolf.localhost
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use the overall start page: http://www.webgoat.local or:
|
|
||||||
|
|
||||||
WebGoat will be located at: http://www.webgoat.local/WebGoat
|
|
||||||
|
|
||||||
WebWolf will be located at: http://www.webwolf.local/WebWolf
|
|
||||||
|
|
||||||
**Important**: the current directory on your host will be mapped into the container for keeping state.
|
|
||||||
|
|
||||||
## 2. Standalone
|
|
||||||
|
|
||||||
Download the latest WebGoat and WebWolf release from [https://github.com/WebGoat/WebGoat/releases](https://github.com/WebGoat/WebGoat/releases)
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
java -jar webgoat-server-8.1.0.jar [--server.port=8080] [--server.address=localhost]
|
|
||||||
java -jar webwolf-8.1.0.jar [--server.port=9090] [--server.address=localhost]
|
|
||||||
```
|
|
||||||
|
|
||||||
The latest version of WebGoat needs Java 11 or above. By default WebGoat and WebWolf start on port 8080,9000 and 9090 with the environment variable WEBGOAT_PORT, WEBWOLF_PORT and WEBGOAT_HSQLPORT you can set different values.
|
|
||||||
```Shell
|
|
||||||
export WEBGOAT_PORT=18080
|
|
||||||
export WEBGOAT_HSQLPORT=19001
|
|
||||||
export WEBWOLF_PORT=19090
|
|
||||||
java -jar webgoat-server-8.1.0.jar
|
|
||||||
java -jar webwolf-8.1.0.jar
|
|
||||||
```
|
|
||||||
Use set in stead of export on Windows cmd.
|
|
||||||
|
|
||||||
|
|
||||||
## 3. Run from the sources
|
|
||||||
|
|
||||||
### Prerequisites:
|
|
||||||
|
|
||||||
* Java 11
|
|
||||||
* Maven > 3.2.1
|
|
||||||
* Your favorite IDE
|
|
||||||
* Git, or Git support in your IDE
|
|
||||||
|
|
||||||
Open a command shell/window:
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
git clone git@github.com:WebGoat/WebGoat.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Now let's start by compiling the project.
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
cd WebGoat
|
|
||||||
git checkout <<branch_name>>
|
|
||||||
mvn clean install
|
|
||||||
```
|
|
||||||
|
|
||||||
Now we are ready to run the project. WebGoat 8.x is using Spring-Boot.
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
mvn -pl webgoat-server spring-boot:run
|
|
||||||
```
|
|
||||||
... you should be running webgoat on localhost:8080/WebGoat momentarily
|
|
||||||
|
|
||||||
|
|
||||||
To change IP address add the following variable to WebGoat/webgoat-container/src/main/resources/application.properties file
|
|
||||||
|
|
||||||
```
|
|
||||||
server.address=x.x.x.x
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4. Run with custom menu
|
|
||||||
|
|
||||||
For specialist only. There is a way to set up WebGoat with a personalized menu. You can leave out some menu categories or individual lessons by setting environment variables.
|
|
||||||
|
|
||||||
For instance running as a jar on a Linux/MacOS it will look like:
|
|
||||||
```Shell
|
|
||||||
export EXCLUDE_CATEGORIES="CLIENT_SIDE,GENERAL,CHALLENGE"
|
|
||||||
export EXCLUDE_LESSONS="SqlInjectionAdvanced,SqlInjectionMitigations"
|
|
||||||
java -jar webgoat-server/target/webgoat-server-v8.2.0-SNAPSHOT.jar
|
|
||||||
```
|
|
||||||
Or in a docker run it would (once this version is pushed into docker hub) look like:
|
|
||||||
```Shell
|
|
||||||
docker run -d -p 80:8888 -p 8080:8080 -p 9090:9090 -e TZ=Europe/Amsterdam -e EXCLUDE_CATEGORIES="CLIENT_SIDE,GENERAL,CHALLENGE" -e EXCLUDE_LESSONS="SqlInjectionAdvanced,SqlInjectionMitigations" webgoat/goatandwolf
|
|
||||||
```
|
|
116
README.md
Normal file
116
README.md
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
# WebGoat 8: A deliberately insecure Web Application
|
||||||
|
|
||||||
|
[](https://github.com/WebGoat/WebGoat/actions/workflows/pr_build.yml)
|
||||||
|
[](https://jdk.java.net/)
|
||||||
|
[](https://owasp.org/projects/)
|
||||||
|
[](https://github.com/WebGoat/WebGoat/releases/latest)
|
||||||
|
[](https://gitter.im/OWASPWebGoat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||||
|
[](https://github.com/WebGoat/WebGoat/discussions)
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
WebGoat is a deliberately insecure web application maintained by [OWASP](http://www.owasp.org/) designed to teach web
|
||||||
|
application security lessons.
|
||||||
|
|
||||||
|
This program is a demonstration of common server-side application flaws. The
|
||||||
|
exercises are intended to be used by people to learn about application security and
|
||||||
|
penetration testing techniques.
|
||||||
|
|
||||||
|
**WARNING 1:** *While running this program your machine will be extremely
|
||||||
|
vulnerable to attack. You should disconnect from the Internet while using
|
||||||
|
this program.* WebGoat's default configuration binds to localhost to minimize
|
||||||
|
the exposure.
|
||||||
|
|
||||||
|
**WARNING 2:** *This program is for educational purposes only. If you attempt
|
||||||
|
these techniques without authorization, you are very likely to get caught. If
|
||||||
|
you are caught engaging in unauthorized hacking, most companies will fire you.
|
||||||
|
Claiming that you were doing security research will not work as that is the
|
||||||
|
first thing that all hackers claim.*
|
||||||
|
|
||||||
|
# Installation instructions:
|
||||||
|
|
||||||
|
For more details check [the Contribution guide](/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## 1. Run using Docker
|
||||||
|
|
||||||
|
Every release is also published on [DockerHub](https://hub.docker.com/r/webgoat/goatandwolf).
|
||||||
|
|
||||||
|
The easiest way to start WebGoat as a Docker container is to use the all-in-one docker container. This is a docker image that has WebGoat and WebWolf running inside.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
|
||||||
|
docker run -it -p 127.0.0.1:80:8888 -p 127.0.0.1:8080:8080 -p 127.0.0.1:9090:9090 -e TZ=Europe/Amsterdam webgoat/goatandwolf:v8.2.2
|
||||||
|
```
|
||||||
|
|
||||||
|
The landing page will be located at: http://localhost
|
||||||
|
WebGoat will be located at: http://localhost:8080/WebGoat
|
||||||
|
WebWolf will be located at: http://localhost:9090/WebWolf
|
||||||
|
|
||||||
|
**Important**: *Change the ports if necessary, for example use `127.0.0.1:7777:9090` to map WebWolf to `http://localhost:7777/WebGoat`*
|
||||||
|
|
||||||
|
**Important**: *Choose the correct timezone, so that the docker container and your host are in the same timezone. As it is important for the validity of JWT tokens used in certain exercises.*
|
||||||
|
|
||||||
|
|
||||||
|
## 2. Standalone
|
||||||
|
|
||||||
|
Download the latest WebGoat and WebWolf release from [https://github.com/WebGoat/WebGoat/releases](https://github.com/WebGoat/WebGoat/releases)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
java -Dfile.encoding=UTF-8 -jar webgoat-server-8.2.2.jar [--server.port=8080] [--server.address=localhost] [--hsqldb.port=9001]
|
||||||
|
java -Dfile.encoding=UTF-8 -jar webwolf-8.2.2.jar [--server.port=9090] [--server.address=localhost] [--hsqldb.port=9001]
|
||||||
|
```
|
||||||
|
|
||||||
|
WebGoat will be located at: http://localhost:8080/WebGoat and
|
||||||
|
WebWolf will be located at: http://localhost:9090/WebWolf (change ports if necessary)
|
||||||
|
|
||||||
|
## 3. Run from the sources
|
||||||
|
|
||||||
|
### Prerequisites:
|
||||||
|
|
||||||
|
* Java 17
|
||||||
|
* Maven > 3.2.1
|
||||||
|
* Your favorite IDE
|
||||||
|
* Git, or Git support in your IDE
|
||||||
|
|
||||||
|
Open a command shell/window:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
git clone git@github.com:WebGoat/WebGoat.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Now let's start by compiling the project.
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
cd WebGoat
|
||||||
|
git checkout <<branch_name>>
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
|
||||||
|
Now we are ready to run the project. WebGoat 8.x is using Spring-Boot.
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
mvn -pl webgoat-server spring-boot:run
|
||||||
|
```
|
||||||
|
... you should be running webgoat on localhost:8080/WebGoat momentarily
|
||||||
|
|
||||||
|
|
||||||
|
To change the IP address add the following variable to the WebGoat/webgoat-container/src/main/resources/application.properties file:
|
||||||
|
|
||||||
|
```
|
||||||
|
server.address=x.x.x.x
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Run with custom menu
|
||||||
|
|
||||||
|
For specialist only. There is a way to set up WebGoat with a personalized menu. You can leave out some menu categories or individual lessons by setting certain environment variables.
|
||||||
|
|
||||||
|
For instance running as a jar on a Linux/macOS it will look like this:
|
||||||
|
```Shell
|
||||||
|
export EXCLUDE_CATEGORIES="CLIENT_SIDE,GENERAL,CHALLENGE"
|
||||||
|
export EXCLUDE_LESSONS="SqlInjectionAdvanced,SqlInjectionMitigations"
|
||||||
|
java -jar webgoat-server/target/webgoat-server-v8.2.2-SNAPSHOT.jar
|
||||||
|
```
|
||||||
|
Or in a docker run it would (once this version is pushed into docker hub) look like this:
|
||||||
|
```Shell
|
||||||
|
docker run -d -p 80:8888 -p 8080:8080 -p 9090:9090 -e TZ=Europe/Amsterdam -e EXCLUDE_CATEGORIES="CLIENT_SIDE,GENERAL,CHALLENGE" -e EXCLUDE_LESSONS="SqlInjectionAdvanced,SqlInjectionMitigations" webgoat/goatandwolf
|
||||||
|
```
|
@ -1,5 +1,70 @@
|
|||||||
# WebGoat release notes
|
# WebGoat release notes
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### New functionality
|
||||||
|
|
||||||
|
- Update the Docker startup script, it is now possible to pass `skip-nginx` or set `SKIP_NGINX` as environment variable.
|
||||||
|
|
||||||
|
## Version 8.2.2
|
||||||
|
|
||||||
|
### New functionality
|
||||||
|
|
||||||
|
- Docker image now supports nginx when browsing to http://localhost a landing page is shown.
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- [#1039 jwt-7-Code review](https://github.com/WebGoat/WebGoat/issues/1039)
|
||||||
|
- [#1031 SQL Injection (intro) 5: Data Control Language (DCL) the wiki's solution is not correct](https://github.com/WebGoat/WebGoat/issues/1031)
|
||||||
|
- [#1027 Webgoat 8.2.1 Vulnerable_Components_12 Shows internal server error](https://github.com/WebGoat/WebGoat/issues/1027)
|
||||||
|
|
||||||
|
|
||||||
|
## Version 8.2.1
|
||||||
|
|
||||||
|
### New functionality
|
||||||
|
|
||||||
|
- New Docker image for arm64 architecture is now available (for Apple M1)
|
||||||
|
|
||||||
|
|
||||||
|
## Version 8.2.0
|
||||||
|
|
||||||
|
### New functionality
|
||||||
|
|
||||||
|
- Add new zip slip lesson (part of path traversal)
|
||||||
|
- SQL lessons are now separate for each user, database are now per user and no longer shared across users
|
||||||
|
- Moved to Java 15 & Spring Boot 2.4 & moved to JUnit 5
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- [#974 SQL injection Intro 5 not solvable](https://github.com/WebGoat/WebGoat/issues/974)
|
||||||
|
- [#962 SQL-Lesson 5 (Advanced) Solvable with wrong anwser](https://github.com/WebGoat/WebGoat/issues/962)
|
||||||
|
- [#961 SQl-Injection lesson 4 not deleting created row](https://github.com/WebGoat/WebGoat/issues/961)
|
||||||
|
- [#949 Challenge: Admin password reset always solvable](https://github.com/WebGoat/WebGoat/issues/949)
|
||||||
|
- [#923 - Upgrade to Java 15](https://github.com/WebGoat/WebGoat/issues/923)
|
||||||
|
- [#922 - Vulnerable components lesson](https://github.com/WebGoat/WebGoat/issues/922)
|
||||||
|
- [#891 - Update the OWASP website with the new all-in-one Docker container](https://github.com/WebGoat/WebGoat/issues/891)
|
||||||
|
- [#844 - Suggestion: Update navigation](https://github.com/WebGoat/WebGoat/issues/844)
|
||||||
|
- [#843 - Bypass front-end restrictions: Field restrictions - confusing text in form](https://github.com/WebGoat/WebGoat/issues/843)
|
||||||
|
- [#841 - XSS - Reflected XSS confusing instruction and success messages](https://github.com/WebGoat/WebGoat/issues/841)
|
||||||
|
- [#839 - SQL Injection (mitigation) Order by clause confusing](https://github.com/WebGoat/WebGoat/issues/839)
|
||||||
|
- [#838 - SQL mitigation (filtering) can only be passed by updating table](https://github.com/WebGoat/WebGoat/issues/838)
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
Special thanks to the following contributors providing us with a pull request:
|
||||||
|
|
||||||
|
- nicholas-quirk
|
||||||
|
- VijoPlays
|
||||||
|
- aolle
|
||||||
|
- trollingHeifer
|
||||||
|
- maximmasiutin
|
||||||
|
- toshihue
|
||||||
|
- avivmu
|
||||||
|
- KellyMarchewa
|
||||||
|
- NatasG
|
||||||
|
- gabe-sky
|
||||||
|
|
||||||
|
|
||||||
## Version 8.1.0
|
## Version 8.1.0
|
||||||
|
|
||||||
### New functionality
|
### New functionality
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
version: 0.1
|
|
||||||
|
|
||||||
phases:
|
|
||||||
build:
|
|
||||||
commands:
|
|
||||||
- mvn package
|
|
||||||
|
|
||||||
artifacts:
|
|
||||||
files:
|
|
||||||
- webgoat-server/target/webgoat-server-8.0-SNAPSHOT.jar
|
|
||||||
discard-paths: yes
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
version: '2.1'
|
|
||||||
|
|
||||||
services:
|
|
||||||
webgoat:
|
|
||||||
image: webgoat/webgoat-v8.0.0.snapshot
|
|
||||||
extends:
|
|
||||||
file: docker-compose.yml
|
|
||||||
service: webgoat
|
|
||||||
webwolf:
|
|
||||||
extends:
|
|
||||||
file: docker-compose.yml
|
|
||||||
service: webwolf
|
|
||||||
image: webgoat/webwolf-v8.0.0.snapshot
|
|
@ -1,40 +0,0 @@
|
|||||||
version: '2.0'
|
|
||||||
|
|
||||||
services:
|
|
||||||
webgoat:
|
|
||||||
image: webgoat/webgoat-8.0
|
|
||||||
user: webgoat
|
|
||||||
environment:
|
|
||||||
- WEBWOLF_HOST=webwolf
|
|
||||||
- WEBWOLF_PORT=9090
|
|
||||||
- spring.datasource.url=jdbc:postgresql://webgoat_db:5432/webgoat?user=webgoat&password=webgoat
|
|
||||||
- spring.datasource.username=webgoat
|
|
||||||
- spring.datasource.password=webgoat
|
|
||||||
- spring.datasource.driver-class-name=org.postgresql.Driver
|
|
||||||
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL10Dialect
|
|
||||||
- webgoat.server.directory=/home/webgoat/.webgoat/
|
|
||||||
- webgoat.user.directory=/home/webgoat/.webgoat/
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
webwolf:
|
|
||||||
image: webgoat/webwolf
|
|
||||||
environment:
|
|
||||||
- spring.datasource.url=jdbc:postgresql://webgoat_db:5432/webgoat?user=webgoat&password=webgoat
|
|
||||||
- spring.datasource.username=webgoat
|
|
||||||
- spring.datasource.password=webgoat
|
|
||||||
- spring.datasource.driver-class-name=org.postgresql.Driver
|
|
||||||
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL10Dialect
|
|
||||||
ports:
|
|
||||||
- "9090:9090"
|
|
||||||
webgoat_db:
|
|
||||||
image: postgres:10.12
|
|
||||||
# Uncomment to store the state of the database on the host.
|
|
||||||
# volumes:
|
|
||||||
# - ./database:/var/lib/postgresql
|
|
||||||
environment:
|
|
||||||
- POSTGRES_PASSWORD=webgoat
|
|
||||||
- POSTGRES_USER=webgoat
|
|
||||||
- POSTGRES_DB=webgoat
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
webgoat:
|
|
||||||
image: webgoat/webgoat-8.0
|
|
||||||
environment:
|
|
||||||
- WEBWOLF_HOST=webwolf
|
|
||||||
- WEBWOLF_PORT=9090
|
|
||||||
- TZ=Europe/Amsterdam
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
- "9001:9001"
|
|
||||||
volumes:
|
|
||||||
- .:/home/webgoat/.webgoat
|
|
||||||
working_dir: /home/webgoat
|
|
||||||
webwolf:
|
|
||||||
image: webgoat/webwolf
|
|
||||||
ports:
|
|
||||||
- "9090:9090"
|
|
||||||
command: --spring.datasource.url=jdbc:hsqldb:hsql://webgoat:9001/webgoat --server.address=0.0.0.0
|
|
||||||
depends_on:
|
|
||||||
- webgoat
|
|
1
docker/.gitignore
vendored
1
docker/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
*.jar
|
|
@ -1,32 +1,22 @@
|
|||||||
FROM openjdk:11.0.1-jre-slim-stretch
|
FROM eclipse-temurin:17_35-jdk-focal
|
||||||
|
|
||||||
ARG webgoat_version=v8.2.0-SNAPSHOT
|
RUN apt-get update
|
||||||
ENV webgoat_version_env=${webgoat_version}
|
RUN useradd -ms /bin/bash webgoat
|
||||||
|
RUN apt-get -y install apt-utils nginx
|
||||||
RUN apt-get update && apt-get install
|
|
||||||
RUN useradd --home-dir /home/webgoat --create-home -U webgoat
|
|
||||||
RUN cd /home/webgoat/;
|
|
||||||
RUN chgrp -R 0 /home/webgoat
|
RUN chgrp -R 0 /home/webgoat
|
||||||
RUN chmod -R g=u /home/webgoat
|
RUN chmod -R g=u /home/webgoat
|
||||||
RUN apt-get -y install apt-utils nginx
|
|
||||||
|
|
||||||
USER webgoat
|
USER webgoat
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY --chown=webgoat nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY index.html /usr/share/nginx/html/
|
COPY --chown=webgoat index.html /usr/share/nginx/html/
|
||||||
COPY webgoat-server-${webgoat_version}.jar /home/webgoat/webgoat.jar
|
COPY --chown=webgoat target/webgoat-server-*.jar /home/webgoat/webgoat.jar
|
||||||
COPY webwolf-${webgoat_version}.jar /home/webgoat/webwolf.jar
|
COPY --chown=webgoat target/webwolf-*.jar /home/webgoat/webwolf.jar
|
||||||
COPY start.sh /home/webgoat
|
COPY --chown=webgoat start.sh /home/webgoat
|
||||||
|
RUN chmod +x /home/webgoat/start.sh
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
EXPOSE 9090
|
EXPOSE 9090
|
||||||
|
|
||||||
ENV WEBGOAT_PORT 8080
|
|
||||||
ENV WEBGOAT_SSLENABLED false
|
|
||||||
|
|
||||||
ENV GOATURL https://127.0.0.1:$WEBGOAT_PORT
|
|
||||||
ENV WOLFURL http://127.0.0.1:9090
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /home/webgoat
|
WORKDIR /home/webgoat
|
||||||
ENTRYPOINT /bin/bash /home/webgoat/start.sh $webgoat_version_env
|
ENTRYPOINT ["./start.sh"]
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
## Docker build
|
## Docker build
|
||||||
|
|
||||||
docker build --no-cache --build-arg webgoat_version=v8.2.0-SNAPSHOT -t webgoat/goatandwolf:latest .
|
```shell
|
||||||
|
docker build --no-cache --build-arg webgoat_version=8.2.0-SNAPSHOT -t webgoat/goatandwolf:latest .
|
||||||
|
```
|
||||||
|
|
||||||
## Docker run
|
## Docker run
|
||||||
|
|
||||||
docker run -d -p 80:8888 -p 8080:8080 -p 9090:9090 -e TZ=Europe/Amsterdam webgoat/goatandwolf:latest
|
```shell
|
||||||
|
docker run -p 127.0.0.1:80:8888 -p 127.0.0.1:8080:8080 -p 127.0.0.1:9090:9090 -e TZ=Europe/Amsterdam webgoat/goatandwolf:latest
|
||||||
|
```
|
@ -1,43 +1,70 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<head>
|
||||||
<h1>OWASP WebGoat Training tools</h1>
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<p>
|
<style>
|
||||||
Use the following links to access the WebGoat and WebWolf applications.
|
|
||||||
Register a user using WebGoat. The same user can access WebWolf.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2>Use without special host name entries</h2>
|
.p1 {
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
<table>
|
.webgoat {
|
||||||
<tr>
|
float: left;
|
||||||
<td>WebGoat URL</td>
|
margin-right: 250px;
|
||||||
<td><a href="http://127.0.0.1:8080/WebGoat" target="_blank">http://127.0.0.1:8080/WebGoat</a></td>
|
text-align: center;
|
||||||
</tr>
|
}
|
||||||
<tr>
|
|
||||||
<td>WebWolf URL</td>
|
|
||||||
<td><a href="http://127.0.0.1:9090/WebWolf" target="_blank">http://127.0.0.1:9090/WebWolf</a></td>
|
|
||||||
</tr>
|
|
||||||
<table>
|
|
||||||
|
|
||||||
<h2>Use with www.webgoat.local and www.webwolf.local</h2>
|
.webwolf {
|
||||||
<p>
|
float: left;
|
||||||
Add the following entries to your local <b><i>hosts</i></b> file on Windows (c:\Windows\System32\drivers\etc\hosts) or Linux (/etc/hosts)
|
width: 40%;
|
||||||
|
height: 40%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
<pre>
|
#images {
|
||||||
127.0.0.1 www.webgoat.local www.webwolf.local
|
display: flex;
|
||||||
</pre>
|
align-items: center;
|
||||||
Then use the following URL's:
|
justify-content: center;
|
||||||
</p>
|
}
|
||||||
<table>
|
|
||||||
<tr>
|
body {
|
||||||
<td>WebGoat URL</td>
|
|
||||||
<td><a href="http://www.webgoat.local/WebGoat" target="_blank">http://www.webgoat.local/WebGoat</a></td>
|
text-align: center;
|
||||||
</tr>
|
|
||||||
<tr>
|
}
|
||||||
<td>WebWolf URL</td>
|
</style>
|
||||||
<td><a href="http://www.webwolf.local/WebWolf" target="_blank">http://www.webwolf.local/WebWolf</a></td>
|
</head>
|
||||||
</tr>
|
<body>
|
||||||
<table>
|
|
||||||
</body>
|
|
||||||
|
<h1>
|
||||||
|
<center>
|
||||||
|
Landing page for WebGoat and WebWolf
|
||||||
|
</center>
|
||||||
|
</h1>
|
||||||
|
<blockquote class="p1">
|
||||||
|
WebGoat is a deliberately insecure web application maintained by <a href="http://www.owasp.org/">OWASP</a> designed
|
||||||
|
to teach web
|
||||||
|
application security lessons.
|
||||||
|
|
||||||
|
This program is a demonstration of common server-side application flaws. The
|
||||||
|
exercises are intended to be used by people to learn about application security and
|
||||||
|
penetration testing techniques.
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<p class="p1">Click on one of the images to go to WebGoat or WebWolf</p>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div id="images">
|
||||||
|
<a href="http://127.0.0.1:8080/WebGoat" title="Open WebGoat" target="_blank"><img class="webgoat"
|
||||||
|
src="http://127.0.0.1:8080/WebGoat/css/img/logoBG.jpg"></a>
|
||||||
|
<a href="http://127.0.0.1:9090/WebWolf" title="Open WebWolf" target="_blank"><img class="webwolf"
|
||||||
|
src="http://127.0.0.1:9090/images/wolf.png"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.owasp.webgoat</groupId>
|
<groupId>org.owasp.webgoat</groupId>
|
||||||
<artifactId>webgoat-parent</artifactId>
|
<artifactId>webgoat-parent</artifactId>
|
||||||
<version>8.2.0-SNAPSHOT</version>
|
<version>8.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -18,14 +18,14 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
<version>1.8</version>
|
<version>3.0.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>install</phase>
|
<phase>install</phase>
|
||||||
<configuration>
|
<configuration>
|
||||||
<target>
|
<target>
|
||||||
<copy file="../webgoat-server/target/webgoat-server-${project.version}.jar" tofile="webgoat-server-${project.version}.jar"/>
|
<copy file="../webgoat-server/target/webgoat-server-${project.version}.jar" tofile="target/webgoat-server-${project.version}.jar"/>
|
||||||
<copy file="../webwolf/target/webwolf-${project.version}.jar" tofile="webwolf-${project.version}.jar"/>
|
<copy file="../webwolf/target/webwolf-${project.version}.jar" tofile="target/webwolf-${project.version}.jar"/>
|
||||||
</target>
|
</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
<goals>
|
<goals>
|
||||||
|
72
docker/start.sh
Normal file → Executable file
72
docker/start.sh
Normal file → Executable file
@ -1,12 +1,72 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd /home/webgoat
|
cd /home/webgoat
|
||||||
service nginx start
|
|
||||||
sleep 1
|
|
||||||
java -Duser.home=/home/webgoat -Dfile.encoding=UTF-8 -jar webgoat.jar --webgoat.build.version=$1 --server.address=0.0.0.0 > webgoat.log &
|
|
||||||
|
|
||||||
sleep 10
|
function should_start_nginx() {
|
||||||
|
if [[ -v "${SKIP_NGINX}" ]]; then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
for i in "${commandline_args[@]}" ; do [[ $i == "skip-nginx" ]] && return 1 ; done
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function nginx() {
|
||||||
|
if should_start_nginx; then
|
||||||
|
echo "Starting nginx..."
|
||||||
|
service nginx start
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function webgoat() {
|
||||||
|
echo "Starting WebGoat...."
|
||||||
|
java \
|
||||||
|
-Duser.home=/home/webgoat \
|
||||||
|
-Dfile.encoding=UTF-8 \
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.lang.reflect=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.text=ALL-UNNAMED \
|
||||||
|
--add-opens java.desktop/java.beans=ALL-UNNAMED \
|
||||||
|
--add-opens java.desktop/java.awt.font=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/sun.nio.ch=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.io=ALL-UNNAMED \
|
||||||
|
-jar webgoat.jar --server.address=0.0.0.0 > webgoat.log
|
||||||
|
}
|
||||||
|
|
||||||
|
function webwolf() {
|
||||||
|
echo "Starting WebWolf..."
|
||||||
|
java -Duser.home=/home/webgoat -Dfile.encoding=UTF-8 -jar webwolf.jar --server.address=0.0.0.0 > webwolf.log
|
||||||
|
}
|
||||||
|
|
||||||
|
function write_start_message() {
|
||||||
|
until $(curl --output /dev/null --silent --head --fail http://0.0.0.0:8080/WebGoat/health); do
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "
|
||||||
|
__ __ _ _____ _
|
||||||
|
\ \ / / | | / ____| | |
|
||||||
|
\ \ /\ / / ___ | |__ | | __ ___ __ _ | |_
|
||||||
|
\ \/ \/ / / _ \ | '_ \ | | |_ | / _ \ / _' | | __|
|
||||||
|
\ /\ / | __/ | |_) | | |__| | | (_) | | (_| | | |_
|
||||||
|
\/ \/ \___| |_.__/ \_____| \___/ \__,_| \__|
|
||||||
|
" >> webgoat.log
|
||||||
|
echo "WebGoat and WebWolf successfully started..." >> webgoat.log
|
||||||
|
pidof nginx >/dev/null && echo "Browse to http://localhost to get started" >> webgoat.log || echo "Browse to http://localhost:8080/WebGoat or http://localhost:9090/WebWolf to get started" >> webgoat.log
|
||||||
|
}
|
||||||
|
|
||||||
|
function tail_log_file() {
|
||||||
|
touch webgoat.log
|
||||||
|
tail -300f webgoat.log
|
||||||
|
}
|
||||||
|
|
||||||
|
commandline_args=("$@")
|
||||||
|
|
||||||
|
nginx
|
||||||
|
webgoat &
|
||||||
|
webwolf &
|
||||||
|
write_start_message &
|
||||||
|
tail_log_file
|
||||||
|
|
||||||
|
|
||||||
java -Duser.home=/home/webgoat -Dfile.encoding=UTF-8 -jar webwolf.jar --webgoat.build.version=$1 --server.address=0.0.0.0 > webwolf.log &
|
|
||||||
|
|
||||||
tail -300f webgoat.log
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
networks:
|
|
||||||
webwolflocal:
|
|
||||||
services:
|
|
||||||
webgoat:
|
|
||||||
hostname: www.webgoat.local
|
|
||||||
image: webgoat/webgoat-8.0
|
|
||||||
environment:
|
|
||||||
- WEBGOAT_PORT=8080
|
|
||||||
- WEBGOAT_SSLENABLED=false
|
|
||||||
- WEBWOLF_HOST=webwolf
|
|
||||||
- WEBWOLF_PORT=9090
|
|
||||||
- TZ=Europe/Amsterdam
|
|
||||||
volumes:
|
|
||||||
- .:/home/webgoat/.webgoat
|
|
||||||
working_dir: /home/webgoat
|
|
||||||
command: --server.address=0.0.0.0
|
|
||||||
networks:
|
|
||||||
webwolflocal:
|
|
||||||
aliases:
|
|
||||||
- goat.webgoat.local
|
|
||||||
webwolf:
|
|
||||||
image: webgoat/webwolf
|
|
||||||
environment:
|
|
||||||
- WEBWOLF_HOST=webwolf
|
|
||||||
- WEBWOLF_PORT=9090
|
|
||||||
- TZ=Europe/Amsterdam
|
|
||||||
command: --spring.datasource.url=jdbc:hsqldb:hsql://webgoat:9001/webgoat --server.address=0.0.0.0
|
|
||||||
networks:
|
|
||||||
webwolflocal:
|
|
||||||
aliases:
|
|
||||||
- wolf.webwolf.local
|
|
||||||
depends_on:
|
|
||||||
- webgoat
|
|
||||||
reverseproxy:
|
|
||||||
hostname: www.webwolf.local
|
|
||||||
image: webgoat/reverseproxy
|
|
||||||
networks:
|
|
||||||
webwolflocal:
|
|
||||||
aliases:
|
|
||||||
- www.webwolf.local
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
@ -1,31 +0,0 @@
|
|||||||
# AWS
|
|
||||||
|
|
||||||
- This contains the various platform Quick Starts for Getting WebGoat Deployed into AWS.
|
|
||||||
- This IaaS quickstart uses AWS CloudFormation to perform most of the provisioning
|
|
||||||
- This IaaS quickstart is composed of three independent bundles
|
|
||||||
- Code pipeline and Build
|
|
||||||
- Deploying to EC2
|
|
||||||
- Deploying to ECS
|
|
||||||
|
|
||||||
|
|
||||||
It is Assumed:
|
|
||||||
- You have an AWS Account
|
|
||||||
- You know what an S3 bucket is
|
|
||||||
- You have seen the IAM console and have permissions to create IAM Roles
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Code Pipeline and Build
|
|
||||||
|
|
||||||
This Quickstart is for those that just want to perform builds with AWS. It Triggers off of Github to perform builds of `webgoat-server`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## EC2
|
|
||||||
|
|
||||||
(WIP) This uses AWS CodePipeline, CodeBuild, and CodeDeploy to land WebGoat to Running EC2 instances
|
|
||||||
|
|
||||||
## ECS
|
|
||||||
|
|
||||||
(WIP) This uses AWS CodePipeline, CodeBuild, ECR, to land a container onto an ECS cluster
|
|
@ -1,101 +0,0 @@
|
|||||||
{
|
|
||||||
"AWSTemplateFormatVersion": "2010-09-09",
|
|
||||||
"Description": "IAM Roles for Code Build WebGoat IaaS Quickstart",
|
|
||||||
"Parameters": {
|
|
||||||
"qsS3BucketName": {
|
|
||||||
"Description": "Name of the S3 Bucket for artifacts",
|
|
||||||
"Type": "String",
|
|
||||||
"MinLength": "1"
|
|
||||||
},
|
|
||||||
"qsRoleName": {
|
|
||||||
"Description": "Name of the IAM role that CodeBuild Will Use",
|
|
||||||
"Type": "String",
|
|
||||||
"Default": "SimpleCodeBuildRole",
|
|
||||||
"MinLength": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Resources": {
|
|
||||||
"qsCodeBuildRole": {
|
|
||||||
"Type": "AWS::IAM::Role",
|
|
||||||
"Properties": {
|
|
||||||
"AssumeRolePolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Principal": {
|
|
||||||
"Service": [
|
|
||||||
"codebuild.amazonaws.com"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Action": [
|
|
||||||
"sts:AssumeRole"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Path": "/webgoat/",
|
|
||||||
"RoleName": {
|
|
||||||
"Ref": "qsRoleName"
|
|
||||||
},
|
|
||||||
"ManagedPolicyArns": [
|
|
||||||
"arn:aws:iam::aws:policy/AWSCodeCommitFullAccess",
|
|
||||||
"arn:aws:iam::aws:policy/AWSCodeBuildDeveloperAccess",
|
|
||||||
"arn:aws:iam::aws:policy/AWSCodeDeployDeployerAccess"
|
|
||||||
],
|
|
||||||
"Policies": [
|
|
||||||
{
|
|
||||||
"PolicyName": "CloudWatchLogs",
|
|
||||||
"PolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Resource": [
|
|
||||||
{"Fn::Join": [ "",["arn:aws:logs:*:", { "Ref": "AWS::AccountId" }, ":log-group:/aws/codebuild*" ] ]}
|
|
||||||
],
|
|
||||||
"Action": [
|
|
||||||
"logs:CreateLogGroup",
|
|
||||||
"logs:CreateLogStream",
|
|
||||||
"logs:PutLogEvents"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"PolicyName": "S3buckets",
|
|
||||||
"PolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Resource": [
|
|
||||||
{
|
|
||||||
"Fn::Join": [
|
|
||||||
"",
|
|
||||||
[
|
|
||||||
"arn:aws:s3:::",
|
|
||||||
{
|
|
||||||
"Ref": "qsS3BucketName"
|
|
||||||
},
|
|
||||||
"*"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"arn:aws:s3:::codepipeline-*"
|
|
||||||
],
|
|
||||||
"Action": [
|
|
||||||
"s3:Put*",
|
|
||||||
"s3:Get*",
|
|
||||||
"s3:List*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,127 +0,0 @@
|
|||||||
{
|
|
||||||
"AWSTemplateFormatVersion": "2010-09-09",
|
|
||||||
"Description": "IAM Role for Code Pipeline WebGoat IaaS Quickstart",
|
|
||||||
"Parameters": {
|
|
||||||
"qsS3BucketName": {
|
|
||||||
"Description": "Name of the S3 Bucket for artifacts",
|
|
||||||
"Type": "String",
|
|
||||||
"MinLength": "1"
|
|
||||||
},
|
|
||||||
"qsRoleName": {
|
|
||||||
"Description": "Name of the IAM role that CodePipeline Will Use",
|
|
||||||
"Type": "String",
|
|
||||||
"Default": "SimpleCodePipelineRole",
|
|
||||||
"MinLength": "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Resources": {
|
|
||||||
"qsCodePipelineRole": {
|
|
||||||
"Type": "AWS::IAM::Role",
|
|
||||||
"Properties": {
|
|
||||||
"AssumeRolePolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Sid": "",
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Principal": {
|
|
||||||
"Service": "codepipeline.amazonaws.com"
|
|
||||||
},
|
|
||||||
"Action": "sts:AssumeRole"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Path": "/webgoat/",
|
|
||||||
"RoleName": {
|
|
||||||
"Ref": "qsRoleName"
|
|
||||||
},
|
|
||||||
"ManagedPolicyArns": [
|
|
||||||
"arn:aws:iam::aws:policy/AWSCodeCommitFullAccess",
|
|
||||||
"arn:aws:iam::aws:policy/AWSCodeBuildDeveloperAccess",
|
|
||||||
"arn:aws:iam::aws:policy/AWSCodeDeployDeployerAccess"
|
|
||||||
],
|
|
||||||
"Policies": [
|
|
||||||
{
|
|
||||||
"PolicyName": "CloudWatchLogsPipeline",
|
|
||||||
"PolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Resource": [
|
|
||||||
{"Fn::Join": [ "",["arn:aws:logs:*:", { "Ref": "AWS::AccountId" }, ":log-group:/aws/*" ] ]}
|
|
||||||
],
|
|
||||||
"Action": [
|
|
||||||
"logs:CreateLogGroup",
|
|
||||||
"logs:CreateLogStream",
|
|
||||||
"logs:PutLogEvents"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"PolicyName": "MiscComputeOpen",
|
|
||||||
"PolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Resource": "*",
|
|
||||||
"Action": [
|
|
||||||
"lambda:InvokeFunction",
|
|
||||||
"lambda:ListFunctions",
|
|
||||||
"elasticbeanstalk:*",
|
|
||||||
"ec2:*",
|
|
||||||
"elasticloadbalancing:*",
|
|
||||||
"autoscaling:*",
|
|
||||||
"cloudwatch:*",
|
|
||||||
"s3:*",
|
|
||||||
"sns:*",
|
|
||||||
"cloudformation:*",
|
|
||||||
"rds:*",
|
|
||||||
"sqs:*",
|
|
||||||
"ecs:*",
|
|
||||||
"iam:PassRole"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"PolicyName": "S3buckets",
|
|
||||||
"PolicyDocument": {
|
|
||||||
"Version": "2012-10-17",
|
|
||||||
"Statement": [
|
|
||||||
{
|
|
||||||
"Effect": "Allow",
|
|
||||||
"Resource": [
|
|
||||||
{
|
|
||||||
"Fn::Join": [
|
|
||||||
"",
|
|
||||||
[
|
|
||||||
"arn:aws:s3:::",
|
|
||||||
{
|
|
||||||
"Ref": "qsS3BucketName"
|
|
||||||
},
|
|
||||||
"*"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"arn:aws:s3:::codepipeline-*",
|
|
||||||
"arn:aws:s3:::elasticbeanstalk*"
|
|
||||||
],
|
|
||||||
"Action": [
|
|
||||||
"s3:Put*",
|
|
||||||
"s3:Get*",
|
|
||||||
"s3:List*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
AWSTemplateFormatVersion: "2010-09-09"
|
|
||||||
|
|
||||||
Description: >
|
|
||||||
AWS Cloud Formation for creating an AWS CodePipeline that checks a git repo for changes and then performs a build using code build
|
|
||||||
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
qsPipelineName:
|
|
||||||
Description: The name of the AWS Code Pipeline
|
|
||||||
Type: String
|
|
||||||
Default: WG-pipeline
|
|
||||||
MinLength: 1
|
|
||||||
qsPipelineRoleARN:
|
|
||||||
Description: The complete ARN to the IAM role that code pipeline should use
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsCodeRepo:
|
|
||||||
Description: The Repository
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsRepoBranch:
|
|
||||||
Description: The Branch in the Repository
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsGitHubUser:
|
|
||||||
Description: The GitHub User Id
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsGitHubAPIToken:
|
|
||||||
Description: The GitHub Personal Access token do not use password
|
|
||||||
NoEcho: true
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsS3PipelineArtifacts:
|
|
||||||
Description: Where Code Pipeline will state artifacts in S3
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsS3CodeBuildArtifacts:
|
|
||||||
Description: Where Code Build will upload Artifacts can be same as codepipeline
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsCodeBuildName:
|
|
||||||
Description: Name of the AWS Code Build
|
|
||||||
Type: String
|
|
||||||
Default: WG-mvnBuilder
|
|
||||||
MinLength: 1
|
|
||||||
qsKMSKeyARN:
|
|
||||||
Description: The KMS ARN that the IAM Role is allowed to use
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
qsCodeRoleArn:
|
|
||||||
Description: The IAM Role ARN for CodePipeline and CodeDeploy
|
|
||||||
Type: String
|
|
||||||
MinLength: 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Resources:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stkcbrCodeBuild:
|
|
||||||
Type: AWS::CodeBuild::Project
|
|
||||||
Properties:
|
|
||||||
Artifacts:
|
|
||||||
Type: CODEPIPELINE
|
|
||||||
Description: Builds WebGoat Jar using build file in repo
|
|
||||||
EncryptionKey: !Ref 'qsKMSKeyARN'
|
|
||||||
Environment:
|
|
||||||
ComputeType: BUILD_GENERAL1_SMALL
|
|
||||||
Image: aws/codebuild/java:openjdk-8
|
|
||||||
Type: LINUX_CONTAINER
|
|
||||||
Name: !Ref 'qsCodeBuildName'
|
|
||||||
ServiceRole: !Ref 'qsCodeRoleArn'
|
|
||||||
TimeoutInMinutes: 10
|
|
||||||
Source:
|
|
||||||
Type: CODEPIPELINE
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stkcplPipeline:
|
|
||||||
Type: AWS::CodePipeline::Pipeline
|
|
||||||
Properties:
|
|
||||||
Name: !Ref 'qsPipelineName'
|
|
||||||
RoleArn: !Ref 'qsPipelineRoleARN'
|
|
||||||
ArtifactStore:
|
|
||||||
Location: !Ref 'qsS3PipelineArtifacts'
|
|
||||||
Type: S3
|
|
||||||
Stages:
|
|
||||||
- Name: CodeRepo
|
|
||||||
Actions:
|
|
||||||
- Name: CodeSource
|
|
||||||
ActionTypeId:
|
|
||||||
Category: Source
|
|
||||||
Owner: ThirdParty
|
|
||||||
Provider: GitHub
|
|
||||||
Version: 1
|
|
||||||
Configuration:
|
|
||||||
Branch: !Ref 'qsRepoBranch'
|
|
||||||
Repo: !Ref 'qsCodeRepo'
|
|
||||||
Owner: !Ref 'qsGitHubUser'
|
|
||||||
OAuthToken: !Ref 'qsGitHubAPIToken'
|
|
||||||
OutputArtifacts:
|
|
||||||
- Name: MySource
|
|
||||||
RunOrder: '1'
|
|
||||||
- Name: Build
|
|
||||||
Actions:
|
|
||||||
- Name: CodeBuild
|
|
||||||
ActionTypeId:
|
|
||||||
Category: Build
|
|
||||||
Owner: AWS
|
|
||||||
Provider: CodeBuild
|
|
||||||
Version: 1
|
|
||||||
InputArtifacts:
|
|
||||||
- Name: MySource
|
|
||||||
Configuration:
|
|
||||||
ProjectName: !Ref stkcbrCodeBuild
|
|
||||||
OutputArtifacts:
|
|
||||||
- Name: MyBuild
|
|
||||||
RunOrder: '2'
|
|
||||||
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
|||||||
# Serverless MVN builds Featuring AWS
|
|
||||||
|
|
||||||
This Quick Start forms the basis for the other AWS quickstarts. This only BUILDS the `webgoat-server` spring boot jar. If you want to also run it on AWS skip to the other AWS quickstarts
|
|
||||||
|
|
||||||
Before you Begin
|
|
||||||
1. Do you have an AWS Account?
|
|
||||||
2. Can you create an S3 Bucket?
|
|
||||||
3. Can you create a KMS Key?
|
|
||||||
4. Do you know what Cloud Formation is?
|
|
||||||
5. Do you have enough permissions to do any real work in said AWS Account?
|
|
||||||
|
|
||||||
If you said no to any of those...hop over to [docs](https://aws.amazon.com/documentation/) and learn (but don't do) how to create those.
|
|
||||||
|
|
||||||
|
|
||||||
You will also need:
|
|
||||||
1. A GitHub Account
|
|
||||||
2. Fork of WebGoat
|
|
||||||
3. Personal access Token with `Admin:repo_hook` and `repo`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Create Pre-requisites
|
|
||||||
|
|
||||||
First pick an AWS region and stick with it for ALL the quickstarts. This one was mostly executed on US-east-1/2 but any region with KMS, CodePipeline, and CodeBuild will work. eu-Central-1, ap-southeast-1 and sa-east-1 have reported success also.
|
|
||||||
|
|
||||||
|
|
||||||
1. Create an S3 bucket and call it something meaningfull like `webgoat-stash-username` or something or use an existing bucket you have access to.
|
|
||||||
2. Create a KMS Key. Make sure you are a key administrator so you can add key users later.
|
|
||||||
|
|
||||||
## Deploy IAM role Cloud Formation Stacks
|
|
||||||
|
|
||||||
In this folder there are two json cloudformation templates:
|
|
||||||
-`01_IAM_codebuild.json`
|
|
||||||
-`01_IAM_codepipeline.json`
|
|
||||||
|
|
||||||
You will use the CloudFormation templates to create two roles. One for CodePipeline and the Other for CodeBuild. You will use the name of the bucket you just created as a parameter.
|
|
||||||
|
|
||||||
## Update KMS Key
|
|
||||||
|
|
||||||
Access the KMS key you created earlier...add the two IAM roles you just created and Key Users
|
|
||||||
|
|
||||||
## Finally the Pipeline
|
|
||||||
|
|
||||||
You will use the yaml cloudformation template `01_codepiplinebuild.yml` to create the code building pipeline.
|
|
||||||
|
|
||||||
Some of the parameters you will need to pass:
|
|
||||||
1. The S3 bucket (twice)
|
|
||||||
2. The Github Branch name (master? develop? yourbranchname?)
|
|
||||||
3. The Github user (if you forked it would be your username)
|
|
||||||
4. You personal access token for GitHub
|
|
||||||
5. The name or the repo (WebGoat! ...unless you renamed and did a whole bunch of fancy git magic)
|
|
||||||
6. The ARN of the KMS key
|
|
||||||
7. The ARN of the role for the codebuild for parameter qsCodeRoleArn
|
|
||||||
8. The ARN for codepipeline
|
|
||||||
|
|
||||||
If this Stack successfully deploys a build will begin based on the latest commit automatically. You will have a funky named zip file (without the .zip ending) in a folder in the S3 bucket in a few minutes.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Congratulations. You just Deployed a two step AWS Codepipeline that looks for codechanges and then performs a build.
|
|
||||||
|
|
||||||
... ON to the next AWS Quickstart
|
|
||||||
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
# GKE - DockerHub
|
|
||||||
|
|
||||||
This Quickstart shows how to create a Kubernettes Cluster using Google Cloud Platform's [GKE](https://cloud.google.com/container-engine/) and WebGoat's Docker [Image](https://hub.docker.com/r/webgoat/webgoat-8.0/).
|
|
||||||
|
|
||||||
To be Successfull with this Quickstart
|
|
||||||
|
|
||||||
1. You have a Google Cloud Platform account and have enough access rights to create Compute Engine and Container Engine Resources
|
|
||||||
2. You know how to `git clone`
|
|
||||||
3. You have the gcloud SDK install and initialized somewhere ( do not use the google cloud shell)
|
|
||||||
|
|
||||||
|
|
||||||
Remeber to perform a 'gcloud auth login' before using the gcloud commands below.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Create Kubernettes Cluster
|
|
||||||
|
|
||||||
You can create a cluster using the Google Cloud Console. The Default settings will suffice. For this QuickStart the cluster name used is `owaspbasiccluster`. The `PROJECTNAME` is whatever your project is. The `REGION` is a region/zone near you.
|
|
||||||
|
|
||||||
If you want to use the gcloud sdk from a properly initialized gcloud commandline environment use the following command
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
gcloud container --project "PROJECTNAME" clusters create "owaspbasiccluster" --zone "REGION" --machine-type "n1-standard-1" --image-type "COS" --disk-size "100" --scopes "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append","https://www.googleapis.com/auth/source.read_only" --num-nodes "3" --network "default" --enable-cloud-logging --no-enable-cloud-monitoring
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
The command creates a similar cluster with more of the options set explicitly.
|
|
||||||
|
|
||||||
## Set up Kubectl
|
|
||||||
|
|
||||||
Using the commandline gcloud SDK environment you need to set-up 'kubectl'
|
|
||||||
|
|
||||||
If you have not already installed 'Kubectl' you can do so with the following command using `gcloud`
|
|
||||||
- `gcloud components install kubectl`
|
|
||||||
|
|
||||||
Then you just run:
|
|
||||||
- `gcloud container clusters get-credentials owaspbasiccluster --zone REGION --project PROJECTNAME`
|
|
||||||
|
|
||||||
|
|
||||||
## Deploy WebGoat Deployment
|
|
||||||
|
|
||||||
Time to deploy the latest DockerImage for WebGoat!
|
|
||||||
|
|
||||||
|
|
||||||
Let's First Make a namespace for this:
|
|
||||||
- `kubectl create namespace webgoat`
|
|
||||||
|
|
||||||
Now it is time to make the magic happen!
|
|
||||||
|
|
||||||
- `kubectl create -f /where_you_git_cloned_webgoat/platformQuickStart/GCP/GKE-Docker/webgoat_noDNSnoTLS.yml`
|
|
||||||
|
|
||||||
This should complete with no errors.
|
|
||||||
|
|
||||||
Use the following command to see information/status about the deployment
|
|
||||||
- `kubectl describe deployment webgoat-dpl --namespace=webgoat`
|
|
||||||
|
|
||||||
After a few minutes the service endpoint should be ready. You can check the status with
|
|
||||||
- `kubectl describe service webgoatsvc --namespace=webgoat`
|
|
||||||
|
|
||||||
In the output you should see a message like "Created load..." after a "Creating load..." which means that the public facing loadbalancer (even thou there is just one container running!) is ready.
|
|
||||||
|
|
||||||
|
|
||||||
If you want to see the Kubernetes dashboard you can run `kubectl proxy` (in a new terminal window) and then navigate to http://localhost:8001/ui .
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Test Deployment
|
|
||||||
|
|
||||||
From the previous `describe service` command the `LoadBalancer Ingress:` line should have the external IP. The line below should give the port.
|
|
||||||
|
|
||||||
So.....
|
|
||||||
|
|
||||||
[IP]:[PORT]/WebGoat in your browser!
|
|
||||||
|
|
||||||
DONE
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
CURTAG=webgoat/webgoat-8.0
|
|
||||||
DEST_TAG=gcr.io/astech-training/raging-wire-webgoat
|
|
||||||
CLUSTER_NAME=raging-wire-webgoat
|
|
||||||
PORT_NUM=8080
|
|
@ -1,4 +0,0 @@
|
|||||||
CURTAG=webgoat/webgoat-8.0
|
|
||||||
DEST_TAG=gcr.io/your-gke-project/your-webgoat-tag
|
|
||||||
CLUSTER_NAME=your-cluster-name
|
|
||||||
PORT_NUM=8080
|
|
@ -1,39 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: webgoatapp
|
|
||||||
name: webgoatsvc
|
|
||||||
namespace: webgoat
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
-
|
|
||||||
port: 8080
|
|
||||||
protocol: TCP
|
|
||||||
selector:
|
|
||||||
app: webgoatapp
|
|
||||||
type: LoadBalancer
|
|
||||||
---
|
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: webgoat-dpl
|
|
||||||
namespace: webgoat
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
name: webgoatapp
|
|
||||||
labels:
|
|
||||||
app: webgoatapp
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
-
|
|
||||||
image: webgoat/webgoat-8.0
|
|
||||||
name: webgoat
|
|
||||||
ports:
|
|
||||||
-
|
|
||||||
containerPort: 8080
|
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
# WebGoat on GCP!
|
|
||||||
|
|
||||||
This folder contains sub folders for the various ways you could deploy WebGoat on Google Cloud Platform
|
|
||||||
|
|
||||||
It is assumed:
|
|
||||||
1. You have a Google Cloud Platform Account
|
|
||||||
2. You can use Git
|
|
||||||
3. You can use a Linux/Mac/Google Cloud Shell
|
|
||||||
|
|
||||||
|
|
||||||
## GKE Docker
|
|
||||||
|
|
||||||
Uses GKE to run the latest DockerHub version of WebGoat8
|
|
||||||
|
|
||||||
## AppEngine
|
|
||||||
|
|
||||||
WIP
|
|
@ -1,22 +0,0 @@
|
|||||||
# OWASP WebGoat Platform Quick Starts
|
|
||||||
|
|
||||||
Want to Run WebGoat? Want to run WebGoat in the Cloud? Don't want to be cloud Expert?
|
|
||||||
|
|
||||||
Do we have a solution for you!
|
|
||||||
|
|
||||||
|
|
||||||
Additionally, Each IaaS/PaaS will have their deployment steps broken down giving the *app-guy-new-to-cloud* an opportunity to learn how said platform works.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## AWS
|
|
||||||
|
|
||||||
Multi-Part Quickstart. Starts with simple pipeline that just builds code to a deploying onto EC2 instances and then containers using ECS/ECR
|
|
||||||
|
|
||||||
## GCP
|
|
||||||
|
|
||||||
Get WebGoat Running on GKE and AppEngine
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
54
platformQuickStarts/helm/Readme.md
Normal file
54
platformQuickStarts/helm/Readme.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Helm chart deployment on OpenShift K8S clusters
|
||||||
|
|
||||||
|
This helm chart can be used on a OpenShift Code Ready Container environment or an OpenShift Cloud Container environment.
|
||||||
|
|
||||||
|
With the OpenShift CRC (Code Ready Container) cluster you run an entire environment on your local machine. (> 4 vCPU, >8GB mem)
|
||||||
|
|
||||||
|
See the Red Hat documentation for general understanding of OpenShift. Make sure helm is installed as well.
|
||||||
|
|
||||||
|
https://developers.redhat.com/developer-sandbox
|
||||||
|
|
||||||
|
## CRC commands
|
||||||
|
|
||||||
|
crc config set cpus 6
|
||||||
|
crc config set memory 12288
|
||||||
|
crc setup
|
||||||
|
crc start
|
||||||
|
eval $(crc oc-env)
|
||||||
|
oc login -u developer https://api.crc.testing:6443
|
||||||
|
oc new-project demo-project
|
||||||
|
|
||||||
|
The example without modification uses *demo-project* as the project/namespace for installing WebGoat and WebWolf.
|
||||||
|
|
||||||
|
|
||||||
|
## Helm install this example on your local Code Ready Container environment
|
||||||
|
|
||||||
|
helm install goat1 ./webgoat
|
||||||
|
|
||||||
|
## Helm install on single node Developer Sandbox (cloud)
|
||||||
|
|
||||||
|
oc login --token=sha256~phDWy6Wm_oJQW6kmOHEbLkRdDIXU6b70hRVmdSYWolM --server=https://api.sandbox-m2.rz9k.p1.openshiftapps.com:6443
|
||||||
|
helm install --set namespace=renezubcevic-dev --set accessMode=ReadWriteOnce --set urlpostfix=.apps.sandbox-m2.rz9k.p1.openshiftapps.com goat1 ./webgoat
|
||||||
|
|
||||||
|
A code ready container looks the same for all developers on their local machine, but a developer sandbox requires other credentials from your account in the cloud and different namespace and urlpostfix and also a different access mode for the persistent storage.
|
||||||
|
Of course the token here is a fake.
|
||||||
|
|
||||||
|
## uninstall
|
||||||
|
|
||||||
|
helm uninstall goat1
|
||||||
|
|
||||||
|
The URL on a Code Ready Container is build from router name + namespace + default extension .apps-crc.testing:
|
||||||
|
|
||||||
|
+ [https://webgoat-1-goat-demo-project.apps-crc.testing/WebGoat](https://webgoat-1-goat-demo-project.apps-crc.testing/WebGoat)
|
||||||
|
+ [http://webwolf-1-wolf-demo-project.apps-crc.testing/WebWolf](http://webwolf-1-wolf-demo-project.apps-crc.testing/WebWolf)
|
||||||
|
|
||||||
|
## Explanation
|
||||||
|
|
||||||
|
deployment.yaml contains two K8S deployment elements. Both use the same Persistent Volume Claim and use the same Volume mapping.
|
||||||
|
They both use the same image but with other entrypoint and command arguments. The java.io.dir is also mapped to this persistent volume mapping. The number of pods is 1 for both WebGoat and WebWolf. WebGoat uses the WEBWOLF_HOST parameter to know where the external address of WebWolf is defined. WebWolf uses WEBGOAT_HOST to define the internal service address to WebGoat for connecting to the HSQL database
|
||||||
|
|
||||||
|
persistent-storage-claim.yaml contains the OpenShift K8S extension for requestig a volume with Read-Write access that will survive any pod replacements.
|
||||||
|
|
||||||
|
service.yaml defines the service ports for both WebGoat and WebWolf
|
||||||
|
|
||||||
|
route-goat defines an https endpoint toward the 8080 port. route-wolf defines an http port towards the 9090 port.
|
23
platformQuickStarts/helm/modsec/.helmignore
Normal file
23
platformQuickStarts/helm/modsec/.helmignore
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
9
platformQuickStarts/helm/modsec/Chart.yaml
Normal file
9
platformQuickStarts/helm/modsec/Chart.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: modsec
|
||||||
|
description: ModSecurity Core Rule Set
|
||||||
|
|
||||||
|
type: application
|
||||||
|
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
appVersion: "latest"
|
@ -0,0 +1,18 @@
|
|||||||
|
kind: ConfigMap
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.modsec_server.name }}-configmap-modsec
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.modsec_server.name }}
|
||||||
|
data:
|
||||||
|
PARANOIA: '1'
|
||||||
|
EXECUTING_PARANOIA: '2'
|
||||||
|
ANOMALYIN: '5'
|
||||||
|
ANOMALYOUT: '5'
|
||||||
|
ALLOWED_METHODS: 'GET POST'
|
||||||
|
ALLOWED_REQUEST_CONTENT_TYPE: "text/xml|application/xml|text/plain"
|
||||||
|
MAX_FILE_SIZE: '5242880'
|
||||||
|
PORT: '8001'
|
||||||
|
RESTRICTED_EXTENSIONS: '.conf/'
|
||||||
|
BACKEND: 'http://{{ .Values.webgoat_server.name }}-service:8080'
|
45
platformQuickStarts/helm/modsec/templates/deployment.yaml
Normal file
45
platformQuickStarts/helm/modsec/templates/deployment.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
kind: Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.modsec_server.name }}
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ .Values.modsec_server.name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.modsec_server.name }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- resources:
|
||||||
|
limits:
|
||||||
|
memory: "2Gi"
|
||||||
|
cpu: "1"
|
||||||
|
requests:
|
||||||
|
memory: "1Gi"
|
||||||
|
cpu: "0.5"
|
||||||
|
name: modsec
|
||||||
|
ports:
|
||||||
|
- containerPort: 8001
|
||||||
|
protocol: TCP
|
||||||
|
image: {{ .Values.modsec_server.image }}
|
||||||
|
imagePullPolicy: Always
|
||||||
|
terminationMessagePolicy: File
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ .Values.modsec_server.name }}-configmap-modsec
|
||||||
|
restartPolicy: Always
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
securityContext: {}
|
||||||
|
schedulerName: default-scheduler
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 25%
|
||||||
|
maxSurge: 25%
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
progressDeadlineSeconds: 600
|
16
platformQuickStarts/helm/modsec/templates/route-modsec.yml
Normal file
16
platformQuickStarts/helm/modsec/templates/route-modsec.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: route.openshift.io/v1
|
||||||
|
kind: Route
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.modsec_server.name }}
|
||||||
|
name: {{ .Values.modsec_server.name }}-modsec
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
path: /
|
||||||
|
port:
|
||||||
|
targetPort: 8001
|
||||||
|
to:
|
||||||
|
kind: Service
|
||||||
|
name: {{ .Values.modsec_server.name }}-service
|
||||||
|
weight: 100
|
||||||
|
wildcardPolicy: None
|
16
platformQuickStarts/helm/modsec/templates/service.yaml
Normal file
16
platformQuickStarts/helm/modsec/templates/service.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.modsec_server.name }}
|
||||||
|
name: {{ .Values.modsec_server.name }}-service
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: 8001-tcp
|
||||||
|
port: 8001
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 8001
|
||||||
|
selector:
|
||||||
|
app: {{ .Values.modsec_server.name }}
|
||||||
|
sessionAffinity: None
|
13
platformQuickStarts/helm/modsec/values.yaml
Normal file
13
platformQuickStarts/helm/modsec/values.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace: demo-project
|
||||||
|
urlpostfix: .apps-crc.testing
|
||||||
|
accessMode: ReadWriteMany
|
||||||
|
|
||||||
|
modsec_server:
|
||||||
|
name: modsec-1
|
||||||
|
#image: docker.io/franbuehler/modsecurity-crs-rp
|
||||||
|
#image: docker.io/owasp/modsecurity-crs
|
||||||
|
image: docker.io/chrira/modsecurity-crs-rp:openshift
|
||||||
|
|
||||||
|
webgoat_server:
|
||||||
|
name: webgoat-1
|
||||||
|
|
23
platformQuickStarts/helm/webgoat/.helmignore
Normal file
23
platformQuickStarts/helm/webgoat/.helmignore
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
9
platformQuickStarts/helm/webgoat/Chart.yaml
Normal file
9
platformQuickStarts/helm/webgoat/Chart.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: webgoat
|
||||||
|
description: WebGoat Learning Environment
|
||||||
|
|
||||||
|
type: application
|
||||||
|
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
appVersion: "8.2.3-SNAPSHOT"
|
@ -0,0 +1,11 @@
|
|||||||
|
kind: ConfigMap
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.webwolf_server.name }}-configmap
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }}
|
||||||
|
data:
|
||||||
|
TZ: 'Europe/Amsterdam'
|
||||||
|
WEBGOAT_HOST: {{ .Values.webgoat_server.name }}-service
|
||||||
|
|
13
platformQuickStarts/helm/webgoat/templates/configmap.yaml
Normal file
13
platformQuickStarts/helm/webgoat/templates/configmap.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
kind: ConfigMap
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.webgoat_server.name }}-configmap
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }}
|
||||||
|
data:
|
||||||
|
TZ: 'Europe/Amsterdam'
|
||||||
|
EXCLUDE_CATEGORIES: 'CLIENT_SIDE'
|
||||||
|
EXCLUDE_LESSONS: 'SqlInjectionAdvanced'
|
||||||
|
WEBWOLF_HOST: '{{ .Values.webwolf_server.name }}-wolf-{{ .Values.namespace }}{{ .Values.urlpostfix }}'
|
||||||
|
WEBWOLF_PORT: '80'
|
159
platformQuickStarts/helm/webgoat/templates/deployment.yaml
Normal file
159
platformQuickStarts/helm/webgoat/templates/deployment.yaml
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
kind: Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }}
|
||||||
|
name: {{ .Values.webgoat_server.name }}
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ .Values.webgoat_server.name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.webgoat_server.name }}
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: webgoat-volume-1
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ .Values.webgoat_server.name }}-pvc
|
||||||
|
containers:
|
||||||
|
- resources:
|
||||||
|
limits:
|
||||||
|
memory: "2Gi"
|
||||||
|
cpu: "1"
|
||||||
|
requests:
|
||||||
|
memory: "1Gi"
|
||||||
|
cpu: "0.5"
|
||||||
|
name: webgoat
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
#livenessProbe:
|
||||||
|
# failureThreshold: 3
|
||||||
|
# periodSeconds: 10
|
||||||
|
# httpGet:
|
||||||
|
# path: /WebGoat
|
||||||
|
# port: 8080
|
||||||
|
#readinessProbe:
|
||||||
|
# failureThreshold: 3
|
||||||
|
# periodSeconds: 10
|
||||||
|
# initialDelaySeconds: 60
|
||||||
|
## httpGet:
|
||||||
|
# path: /WebGoat
|
||||||
|
# port: 8080
|
||||||
|
image: {{ .Values.webgoat_server.image }}
|
||||||
|
command:
|
||||||
|
- 'java'
|
||||||
|
args: ["-Duser.home=/home/webgoat",
|
||||||
|
"--add-opens","java.base/java.lang=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.base/java.util=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.base/java.lang.reflect=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.base/java.text=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.desktop/java.beans=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.desktop/java.awt.font=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.base/sun.nio.ch=ALL-UNNAMED",
|
||||||
|
"--add-opens","java.base/java.io=ALL-UNNAMED",
|
||||||
|
"-Djava.io.tmpdir=/home/webgoat/.webgoat-{{ .Chart.AppVersion }}",
|
||||||
|
"-Dfile.encoding=UTF-8",
|
||||||
|
"-jar","/home/webgoat/webgoat.jar",
|
||||||
|
"--server.address=0.0.0.0"]
|
||||||
|
imagePullPolicy: Always
|
||||||
|
volumeMounts:
|
||||||
|
- name: webgoat-volume-1
|
||||||
|
mountPath: /home/webgoat/.webgoat-{{ .Chart.AppVersion }}
|
||||||
|
terminationMessagePolicy: File
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ .Values.webgoat_server.name }}-configmap
|
||||||
|
- secretRef:
|
||||||
|
name: {{ .Values.webgoat_server.name }}-secret
|
||||||
|
restartPolicy: Always
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
securityContext: {}
|
||||||
|
schedulerName: default-scheduler
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 25%
|
||||||
|
maxSurge: 25%
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
progressDeadlineSeconds: 600
|
||||||
|
---
|
||||||
|
kind: Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }}
|
||||||
|
name: {{ .Values.webwolf_server.name }}
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ .Values.webwolf_server.name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.webwolf_server.name }}
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: webgoat-volume-1
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ .Values.webgoat_server.name }}-pvc
|
||||||
|
containers:
|
||||||
|
- resources:
|
||||||
|
limits:
|
||||||
|
memory: "2Gi"
|
||||||
|
cpu: "1"
|
||||||
|
requests:
|
||||||
|
memory: "1Gi"
|
||||||
|
cpu: "0.5"
|
||||||
|
name: webwolf
|
||||||
|
ports:
|
||||||
|
- containerPort: 9090
|
||||||
|
protocol: TCP
|
||||||
|
#livenessProbe:
|
||||||
|
# failureThreshold: 3
|
||||||
|
# periodSeconds: 10
|
||||||
|
# httpGet:
|
||||||
|
# path: /WebWolf
|
||||||
|
# port: 9090
|
||||||
|
#readinessProbe:
|
||||||
|
#failureThreshold: 3
|
||||||
|
#periodSeconds: 10
|
||||||
|
#initialDelaySeconds: 100
|
||||||
|
#httpGet:
|
||||||
|
# path: /WebWolf
|
||||||
|
# port: 9090
|
||||||
|
image: {{ .Values.webwolf_server.image }}
|
||||||
|
command:
|
||||||
|
- 'java'
|
||||||
|
args: ["-Duser.home=/home/webgoat",
|
||||||
|
"-Djava.io.tmpdir=/home/webgoat/.webgoat-{{ .Chart.AppVersion }}",
|
||||||
|
"-Dfile.encoding=UTF-8",
|
||||||
|
"-jar","/home/webgoat/webwolf.jar",
|
||||||
|
"--server.address=0.0.0.0"]
|
||||||
|
imagePullPolicy: Always
|
||||||
|
volumeMounts:
|
||||||
|
- name: webgoat-volume-1
|
||||||
|
mountPath: /home/webgoat/.webgoat-{{ .Chart.AppVersion }}
|
||||||
|
terminationMessagePolicy: File
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ .Values.webwolf_server.name }}-configmap
|
||||||
|
restartPolicy: Always
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
securityContext: {}
|
||||||
|
schedulerName: default-scheduler
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 25%
|
||||||
|
maxSurge: 25%
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
progressDeadlineSeconds: 600
|
@ -0,0 +1,13 @@
|
|||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: '{{ .Values.webgoat_server.name }}-pvc'
|
||||||
|
namespace: '{{ .Values.namespace }}'
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- '{{ .Values.accessMode }}'
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
#volumeName: pv0028
|
||||||
|
volumeMode: Filesystem
|
19
platformQuickStarts/helm/webgoat/templates/route-goat.yml
Normal file
19
platformQuickStarts/helm/webgoat/templates/route-goat.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: route.openshift.io/v1
|
||||||
|
kind: Route
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.webgoat_server.name }}
|
||||||
|
name: {{ .Values.webgoat_server.name }}-goat
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
tls:
|
||||||
|
termination: edge
|
||||||
|
insecureEdgeTerminationPolicy: Redirect
|
||||||
|
path: /WebGoat
|
||||||
|
port:
|
||||||
|
targetPort: 8080
|
||||||
|
to:
|
||||||
|
kind: Service
|
||||||
|
name: {{ .Values.webgoat_server.name }}-service
|
||||||
|
weight: 100
|
||||||
|
wildcardPolicy: None
|
16
platformQuickStarts/helm/webgoat/templates/route-wolf.yml
Normal file
16
platformQuickStarts/helm/webgoat/templates/route-wolf.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
apiVersion: route.openshift.io/v1
|
||||||
|
kind: Route
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.webwolf_server.name }}
|
||||||
|
name: {{ .Values.webwolf_server.name }}-wolf
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
path: /
|
||||||
|
port:
|
||||||
|
targetPort: 9090
|
||||||
|
to:
|
||||||
|
kind: Service
|
||||||
|
name: {{ .Values.webwolf_server.name }}-service
|
||||||
|
weight: 100
|
||||||
|
wildcardPolicy: None
|
7
platformQuickStarts/helm/webgoat/templates/secrets.yaml
Normal file
7
platformQuickStarts/helm/webgoat/templates/secrets.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.webgoat_server.name }}-secret
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
stringData:
|
||||||
|
ADMIN_PASSWORD: admin
|
39
platformQuickStarts/helm/webgoat/templates/service.yaml
Normal file
39
platformQuickStarts/helm/webgoat/templates/service.yaml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.webgoat_server.name }}
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }}
|
||||||
|
name: {{ .Values.webgoat_server.name }}-service
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: 8080-tcp
|
||||||
|
port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 8080
|
||||||
|
- name: 9001-tcp
|
||||||
|
port: 9001
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9001
|
||||||
|
selector:
|
||||||
|
app: {{ .Values.webgoat_server.name }}
|
||||||
|
sessionAffinity: None
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Values.webwolf_server.name }}
|
||||||
|
app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }}
|
||||||
|
name: {{ .Values.webwolf_server.name }}-service
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: 9090-tcp
|
||||||
|
port: 9090
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9090
|
||||||
|
selector:
|
||||||
|
app: {{ .Values.webwolf_server.name }}
|
||||||
|
sessionAffinity: None
|
14
platformQuickStarts/helm/webgoat/values.yaml
Normal file
14
platformQuickStarts/helm/webgoat/values.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace: demo-project
|
||||||
|
urlpostfix: .apps-crc.testing
|
||||||
|
accessMode: ReadWriteMany
|
||||||
|
|
||||||
|
webgoat_server:
|
||||||
|
name: webgoat-1
|
||||||
|
image: docker.io/webgoat/goatandwolf:openshift
|
||||||
|
|
||||||
|
webwolf_server:
|
||||||
|
name: webwolf-1
|
||||||
|
image: docker.io/webgoat/goatandwolf:openshift
|
||||||
|
|
||||||
|
|
||||||
|
|
52
pom.xml
52
pom.xml
@ -6,7 +6,13 @@
|
|||||||
<groupId>org.owasp.webgoat</groupId>
|
<groupId>org.owasp.webgoat</groupId>
|
||||||
<artifactId>webgoat-parent</artifactId>
|
<artifactId>webgoat-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>8.2.0-SNAPSHOT</version>
|
<version>8.2.3-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.5.4</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
<name>WebGoat Parent Pom</name>
|
<name>WebGoat Parent Pom</name>
|
||||||
<description>Parent Pom for the WebGoat Project. A deliberately insecure Web Application</description>
|
<description>Parent Pom for the WebGoat Project. A deliberately insecure Web Application</description>
|
||||||
@ -18,12 +24,6 @@
|
|||||||
<url>https://github.com/WebGoat/WebGoat/</url>
|
<url>https://github.com/WebGoat/WebGoat/</url>
|
||||||
</organization>
|
</organization>
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>2.4.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>GNU General Public License, version 2</name>
|
<name>GNU General Public License, version 2</name>
|
||||||
@ -56,6 +56,11 @@
|
|||||||
<name>René Zubcevic</name>
|
<name>René Zubcevic</name>
|
||||||
<email>rene.zubcevic@owasp.org</email>
|
<email>rene.zubcevic@owasp.org</email>
|
||||||
</developer>
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<id>aolle</id>
|
||||||
|
<name>Àngel Ollé Blázquez</name>
|
||||||
|
<email>angel@olleb.com</email>
|
||||||
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<id>jwayman</id>
|
<id>jwayman</id>
|
||||||
<name>Jeff Wayman</name>
|
<name>Jeff Wayman</name>
|
||||||
@ -106,34 +111,28 @@
|
|||||||
<url>https://github.com/WebGoat/WebGoat/issues</url>
|
<url>https://github.com/WebGoat/WebGoat/issues</url>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<ciManagement>
|
|
||||||
<system>Travis CI</system>
|
|
||||||
<url>https://travis-ci.org/WebGoat/WebGoat</url>
|
|
||||||
</ciManagement>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Use UTF-8 Encoding -->
|
<!-- Use UTF-8 Encoding -->
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
||||||
<!-- This build number will be ubdated by Travis-CI -->
|
|
||||||
<build.number>build</build.number>
|
|
||||||
|
|
||||||
<!-- Shared properties with plugins and version numbers across submodules-->
|
<!-- Shared properties with plugins and version numbers across submodules-->
|
||||||
<activation.version>1.1.1</activation.version>
|
<asciidoctorj.version>2.5.2</asciidoctorj.version>
|
||||||
<commons-collections.version>3.2.1</commons-collections.version>
|
<commons-collections.version>3.2.1</commons-collections.version>
|
||||||
<commons-lang3.version>3.4</commons-lang3.version>
|
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||||
<commons-io.version>2.6</commons-io.version>
|
<commons-io.version>2.6</commons-io.version>
|
||||||
<guava.version>30.1-jre</guava.version>
|
<guava.version>30.1-jre</guava.version>
|
||||||
<lombok.version>1.18.4</lombok.version>
|
<lombok.version>1.18.20</lombok.version>
|
||||||
|
<wiremock.version>2.27.2</wiremock.version>
|
||||||
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
||||||
<maven-failsafe-plugin.version>2.22.0</maven-failsafe-plugin.version>
|
<maven-failsafe-plugin.version>2.22.0</maven-failsafe-plugin.version>
|
||||||
<maven-jar-plugin.version>3.1.2</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.2</maven-jar-plugin.version>
|
||||||
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
|
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
|
||||||
<maven-source-plugin.version>3.1.0</maven-source-plugin.version>
|
<maven-source-plugin.version>3.1.0</maven-source-plugin.version>
|
||||||
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
|
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
|
||||||
|
<java.version>17</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@ -188,16 +187,17 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>11</source>
|
<source>15</source>
|
||||||
<target>11</target>
|
<target>15</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.1.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
<consoleOutput>true</consoleOutput>
|
<consoleOutput>true</consoleOutput>
|
||||||
@ -212,7 +212,7 @@
|
|||||||
<artifactId>maven-pmd-plugin</artifactId>
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
<version>3.14.0</version>
|
<version>3.14.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<targetJdk>11</targetJdk>
|
<targetJdk>15</targetJdk>
|
||||||
<failurePriority>1</failurePriority><!-- 5 means fail even on the lowest priority, 0 means never fail -->
|
<failurePriority>1</failurePriority><!-- 5 means fail even on the lowest priority, 0 means never fail -->
|
||||||
<rulesets>
|
<rulesets>
|
||||||
<!--suppress UnresolvedMavenProperty -->
|
<!--suppress UnresolvedMavenProperty -->
|
||||||
@ -243,7 +243,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.owasp</groupId>
|
<groupId>org.owasp</groupId>
|
||||||
<artifactId>dependency-check-maven</artifactId>
|
<artifactId>dependency-check-maven</artifactId>
|
||||||
<version>5.3.2</version>
|
<version>6.1.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<failBuildOnCVSS>7</failBuildOnCVSS>
|
<failBuildOnCVSS>7</failBuildOnCVSS>
|
||||||
<skipProvidedScope>true</skipProvidedScope>
|
<skipProvidedScope>true</skipProvidedScope>
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
nc -zv 127.0.0.1 8080 2>/dev/null
|
|
||||||
SUCCESS=$?
|
|
||||||
nc -zv 127.0.0.1 9090 2>/dev/null
|
|
||||||
SUCCESS=${SUCCESS}$?
|
|
||||||
|
|
||||||
if [[ "${SUCCESS}" -eq 0 ]] ; then
|
|
||||||
echo "WebGoat and or WebWolf are still running, please stop them first otherwise unit tests might fail!"
|
|
||||||
exit 127
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
sh mvnw clean install
|
|
||||||
if [[ "$?" -ne 0 ]] ; then
|
|
||||||
exit y$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd -
|
|
||||||
sh build_docker.sh
|
|
||||||
if [[ "$?" -ne 0 ]] ; then
|
|
||||||
exit y$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
read -p "Do you want to run docker-compose?" yn
|
|
||||||
case ${yn} in
|
|
||||||
[Yy]* ) sh clean-run-docker-compose.sh; break;;
|
|
||||||
[Nn]* ) exit;;
|
|
||||||
* ) echo "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
WEBGOAT_HOME=$(pwd)/../
|
|
||||||
|
|
||||||
cd "${WEBGOAT_HOME}"/webgoat-server
|
|
||||||
docker build -t webgoat/webgoat-v8.0.0.snapshot .
|
|
||||||
|
|
||||||
cd "${WEBGOAT_HOME}"/webwolf
|
|
||||||
docker build -t webgoat/webwolf-v8.0.0.snapshot .
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
docker-compose rm -f
|
|
||||||
docker-compose -f docker-compose-local.yml up
|
|
@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
|
||||||
|
|
||||||
export REPO=webgoat/goatandwolf
|
|
||||||
cd ..
|
|
||||||
cd docker
|
|
||||||
ls target/
|
|
||||||
|
|
||||||
if [ ! -z "${TRAVIS_TAG}" ]; then
|
|
||||||
# If we push a tag to master this will update the LATEST Docker image and tag with the version number
|
|
||||||
docker build --build-arg webgoat_version=${TRAVIS_TAG:1} -f Dockerfile -t $REPO:latest -t $REPO:${TRAVIS_TAG} .
|
|
||||||
docker push $REPO
|
|
||||||
else
|
|
||||||
echo "Skipping releasing to DockerHub because it is a build of branch ${BRANCH}"
|
|
||||||
fi
|
|
@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
docker-compose up
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
DATABASE_PORT=9001
|
|
||||||
|
|
||||||
checkDatabaseAvailable(){
|
|
||||||
|
|
||||||
#for i in $(seq 1 5); do command && s=0 && break || s=$? && sleep 15; done; (exit $s)
|
|
||||||
local started = $(netstat -lnt | grep ${DATABASE_PORT})
|
|
||||||
echo $?
|
|
||||||
}
|
|
||||||
|
|
||||||
#java -Djava.security.egd=file:/dev/./urandom -jar home/webgoat/webgoat.jar --server.address=0.0.0.0
|
|
||||||
$(checkDatabaseAvailable)
|
|
||||||
|
|
||||||
|
|
||||||
#java -Djava.security.egd=file:/dev/./urandom -jar /home/webwolf/webwolf.jar --server.port=9090 --server.address=0.0.0.0
|
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.owasp.webgoat</groupId>
|
<groupId>org.owasp.webgoat</groupId>
|
||||||
<artifactId>webgoat-parent</artifactId>
|
<artifactId>webgoat-parent</artifactId>
|
||||||
<version>8.2.0-SNAPSHOT</version>
|
<version>8.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -17,13 +17,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<version>${maven-surefire-plugin.version}</version>
|
||||||
<forkCount>0</forkCount>
|
|
||||||
<reuseForks>true</reuseForks>
|
|
||||||
<argLine>
|
|
||||||
--illegal-access=permit
|
|
||||||
</argLine>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -54,11 +48,6 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>javax.activation</groupId>
|
|
||||||
<artifactId>activation</artifactId>
|
|
||||||
<version>${activation.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
@ -70,17 +59,11 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.asciidoctor</groupId>
|
<groupId>org.asciidoctor</groupId>
|
||||||
<artifactId>asciidoctorj</artifactId>
|
<artifactId>asciidoctorj</artifactId>
|
||||||
<version>1.5.8.1</version>
|
<version>${asciidoctorj.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>HikariCP</artifactId>
|
|
||||||
<groupId>com.zaxxer</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@ -103,8 +86,6 @@
|
|||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- ************* END spring MVC and related dependencies ************** -->
|
|
||||||
<!-- ************* START: Dependencies for Unit and Integration Testing ************** -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
@ -113,19 +94,8 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-test</artifactId>
|
<artifactId>spring-security-test</artifactId>
|
||||||
<!-- <version>4.1.3.RELEASE</version>-->
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- ************* END: Dependencies for Unit and Integration Testing ************** -->
|
|
||||||
<!-- ************* END: <dependencies> ************** -->
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ public class AsciiDoctorTemplateResolver extends FileTemplateResolver {
|
|||||||
extensionRegistry.inlineMacro("webGoatVersion", WebGoatVersionMacro.class);
|
extensionRegistry.inlineMacro("webGoatVersion", WebGoatVersionMacro.class);
|
||||||
extensionRegistry.inlineMacro("webGoatTempDir", WebGoatTmpDirMacro.class);
|
extensionRegistry.inlineMacro("webGoatTempDir", WebGoatTmpDirMacro.class);
|
||||||
extensionRegistry.inlineMacro("operatingSystem", OperatingSystemMacro.class);
|
extensionRegistry.inlineMacro("operatingSystem", OperatingSystemMacro.class);
|
||||||
|
extensionRegistry.inlineMacro("username", UsernameMacro.class);
|
||||||
|
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
asciidoctor.convert(new InputStreamReader(is), writer, createAttributes());
|
asciidoctor.convert(new InputStreamReader(is), writer, createAttributes());
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package org.owasp.webgoat;
|
||||||
|
|
||||||
|
import org.flywaydb.core.Flyway;
|
||||||
|
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
||||||
|
import org.owasp.webgoat.service.RestartLessonService;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class DatabaseConfiguration {
|
||||||
|
|
||||||
|
private String driverClassName;
|
||||||
|
|
||||||
|
public DatabaseConfiguration(@Value("${spring.datasource.driver-class-name}") String driverClassName) {
|
||||||
|
this.driverClassName = driverClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define 2 Flyway instances, 1 for WebGoat itself which it uses for internal storage like users and 1 for lesson
|
||||||
|
* specific tables we use. This way we clean the data in the lesson database quite easily see {@link RestartLessonService#restartLesson()}
|
||||||
|
* for how we clean the lesson related tables.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Bean(initMethod = "migrate")
|
||||||
|
public Flyway flyWayContainer(DataSource dataSource) {
|
||||||
|
return Flyway
|
||||||
|
.configure()
|
||||||
|
.configuration(Map.of("driver", driverClassName))
|
||||||
|
.dataSource(dataSource)
|
||||||
|
.schemas("container")
|
||||||
|
.locations("db/container")
|
||||||
|
.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Function<String, Flyway> flywayLessons(LessonDataSource lessonDataSource) {
|
||||||
|
return schema -> Flyway
|
||||||
|
.configure()
|
||||||
|
.configuration(Map.of("driver", driverClassName))
|
||||||
|
.schemas(schema)
|
||||||
|
.dataSource(lessonDataSource)
|
||||||
|
.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public LessonDataSource lessonDataSource(DataSource dataSource) {
|
||||||
|
return new LessonDataSource(dataSource);
|
||||||
|
}
|
||||||
|
}
|
@ -1,50 +0,0 @@
|
|||||||
package org.owasp.webgoat;
|
|
||||||
|
|
||||||
import org.flywaydb.core.Flyway;
|
|
||||||
import org.owasp.webgoat.service.RestartLessonService;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define 2 Flyway instances, 1 for WebGoat itself which it uses for internal storage like users and 1 for lesson
|
|
||||||
* specific tables we use. This way we clean the data in the lesson database quite easily see {@link RestartLessonService#restartLesson()}
|
|
||||||
* for how we clean the lesson related tables.
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class DatabaseInitialization {
|
|
||||||
|
|
||||||
private final DataSource dataSource;
|
|
||||||
private String driverClassName;
|
|
||||||
|
|
||||||
public DatabaseInitialization(DataSource dataSource,
|
|
||||||
@Value("${spring.datasource.driver-class-name}") String driverClassName) {
|
|
||||||
this.dataSource = dataSource;
|
|
||||||
this.driverClassName = driverClassName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(initMethod = "migrate")
|
|
||||||
public Flyway flyWayContainer() {
|
|
||||||
return Flyway
|
|
||||||
.configure()
|
|
||||||
.configuration(Map.of("driver", driverClassName))
|
|
||||||
.dataSource(dataSource)
|
|
||||||
.schemas("container")
|
|
||||||
.locations("db/container")
|
|
||||||
.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(initMethod = "migrate")
|
|
||||||
@DependsOn("flyWayContainer")
|
|
||||||
public Flyway flywayLessons() {
|
|
||||||
return Flyway
|
|
||||||
.configure()
|
|
||||||
.configuration(Map.of("driver", driverClassName))
|
|
||||||
.dataSource(dataSource)
|
|
||||||
.load();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,70 @@
|
|||||||
|
package org.owasp.webgoat;
|
||||||
|
|
||||||
|
import org.owasp.webgoat.lessons.LessonConnectionInvocationHandler;
|
||||||
|
import org.springframework.jdbc.datasource.ConnectionProxy;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.SQLFeatureNotSupportedException;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class LessonDataSource implements DataSource {
|
||||||
|
|
||||||
|
private final DataSource originalDataSource;
|
||||||
|
|
||||||
|
public LessonDataSource(DataSource dataSource) {
|
||||||
|
this.originalDataSource = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Connection getConnection() throws SQLException {
|
||||||
|
var targetConnection = originalDataSource.getConnection();
|
||||||
|
return (Connection) Proxy.newProxyInstance(
|
||||||
|
ConnectionProxy.class.getClassLoader(),
|
||||||
|
new Class[]{ConnectionProxy.class},
|
||||||
|
new LessonConnectionInvocationHandler(targetConnection));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Connection getConnection(String username, String password) throws SQLException {
|
||||||
|
return originalDataSource.getConnection(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PrintWriter getLogWriter() throws SQLException {
|
||||||
|
return originalDataSource.getLogWriter();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogWriter(PrintWriter out) throws SQLException {
|
||||||
|
originalDataSource.setLogWriter(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoginTimeout(int seconds) throws SQLException {
|
||||||
|
originalDataSource.setLoginTimeout(seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLoginTimeout() throws SQLException {
|
||||||
|
return originalDataSource.getLoginTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||||
|
return originalDataSource.getParentLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T unwrap(Class<T> clazz) throws SQLException {
|
||||||
|
return originalDataSource.unwrap(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWrapperFor(Class<?> clazz) throws SQLException {
|
||||||
|
return originalDataSource.isWrapperFor(clazz);
|
||||||
|
}
|
||||||
|
}
|
@ -58,7 +58,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry security = http
|
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry security = http
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.antMatchers("/css/**", "/images/**", "/js/**", "fonts/**", "/plugins/**", "/registration", "/register.mvc").permitAll()
|
.antMatchers("/css/**", "/images/**", "/js/**", "fonts/**", "/plugins/**", "/registration", "/register.mvc", "/actuator/**").permitAll()
|
||||||
.anyRequest().authenticated();
|
.anyRequest().authenticated();
|
||||||
security.and()
|
security.and()
|
||||||
.formLogin()
|
.formLogin()
|
||||||
|
@ -1,18 +1,25 @@
|
|||||||
package org.owasp.webgoat.asciidoc;
|
package org.owasp.webgoat.asciidoc;
|
||||||
|
|
||||||
|
import org.asciidoctor.ast.ContentNode;
|
||||||
|
import org.asciidoctor.extension.InlineMacroProcessor;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.asciidoctor.ast.AbstractBlock;
|
|
||||||
import org.asciidoctor.extension.InlineMacroProcessor;
|
|
||||||
|
|
||||||
public class OperatingSystemMacro extends InlineMacroProcessor {
|
public class OperatingSystemMacro extends InlineMacroProcessor {
|
||||||
|
|
||||||
|
public OperatingSystemMacro(String macroName) {
|
||||||
|
super(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
public OperatingSystemMacro(String macroName, Map<String, Object> config) {
|
public OperatingSystemMacro(String macroName, Map<String, Object> config) {
|
||||||
super(macroName, config);
|
super(macroName, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String process(AbstractBlock parent, String target, Map<String, Object> attributes) {
|
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
|
||||||
return System.getProperty("os.name");
|
var osName = System.getProperty("os.name");
|
||||||
|
|
||||||
|
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
|
||||||
|
return createPhraseNode(contentNode, "quoted", osName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package org.owasp.webgoat.asciidoc;
|
||||||
|
|
||||||
|
import org.asciidoctor.ast.ContentNode;
|
||||||
|
import org.asciidoctor.extension.InlineMacroProcessor;
|
||||||
|
import org.owasp.webgoat.users.WebGoatUser;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class UsernameMacro extends InlineMacroProcessor {
|
||||||
|
|
||||||
|
public UsernameMacro(String macroName) {
|
||||||
|
super(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UsernameMacro(String macroName, Map<String, Object> config) {
|
||||||
|
super(macroName, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
|
||||||
|
var auth = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
var username = "unknown";
|
||||||
|
if (auth.getPrincipal() instanceof WebGoatUser) {
|
||||||
|
username = ((WebGoatUser) auth.getPrincipal()).getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
|
||||||
|
return createPhraseNode(contentNode, "quoted", username);
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,26 @@
|
|||||||
package org.owasp.webgoat.asciidoc;
|
package org.owasp.webgoat.asciidoc;
|
||||||
|
|
||||||
import org.asciidoctor.ast.AbstractBlock;
|
import org.asciidoctor.ast.ContentNode;
|
||||||
import org.asciidoctor.extension.InlineMacroProcessor;
|
import org.asciidoctor.extension.InlineMacroProcessor;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class WebGoatTmpDirMacro extends InlineMacroProcessor {
|
public class WebGoatTmpDirMacro extends InlineMacroProcessor {
|
||||||
|
|
||||||
|
public WebGoatTmpDirMacro(String macroName) {
|
||||||
|
super(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
public WebGoatTmpDirMacro(String macroName, Map<String, Object> config) {
|
public WebGoatTmpDirMacro(String macroName, Map<String, Object> config) {
|
||||||
super(macroName, config);
|
super(macroName, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String process(AbstractBlock parent, String target, Map<String, Object> attributes) {
|
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
|
||||||
return EnvironmentExposure.getEnv().getProperty("webgoat.server.directory");
|
var env = EnvironmentExposure.getEnv().getProperty("webgoat.server.directory");
|
||||||
|
|
||||||
|
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
|
||||||
|
return createPhraseNode(contentNode, "quoted", env);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
package org.owasp.webgoat.asciidoc;
|
package org.owasp.webgoat.asciidoc;
|
||||||
|
|
||||||
import org.asciidoctor.ast.AbstractBlock;
|
import org.asciidoctor.ast.ContentNode;
|
||||||
import org.asciidoctor.extension.InlineMacroProcessor;
|
import org.asciidoctor.extension.InlineMacroProcessor;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class WebGoatVersionMacro extends InlineMacroProcessor {
|
public class WebGoatVersionMacro extends InlineMacroProcessor {
|
||||||
|
|
||||||
|
public WebGoatVersionMacro(String macroName) {
|
||||||
|
super(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
public WebGoatVersionMacro(String macroName, Map<String, Object> config) {
|
public WebGoatVersionMacro(String macroName, Map<String, Object> config) {
|
||||||
super(macroName, config);
|
super(macroName, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String process(AbstractBlock parent, String target, Map<String, Object> attributes) {
|
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
|
||||||
return EnvironmentExposure.getEnv().getProperty("webgoat.build.version");
|
var webgoatVersion = EnvironmentExposure.getEnv().getProperty("webgoat.build.version");
|
||||||
|
|
||||||
|
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
|
||||||
|
return createPhraseNode(contentNode, "quoted", webgoatVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,46 @@
|
|||||||
package org.owasp.webgoat.asciidoc;
|
package org.owasp.webgoat.asciidoc;
|
||||||
|
|
||||||
import org.asciidoctor.ast.AbstractBlock;
|
import org.asciidoctor.ast.ContentNode;
|
||||||
import org.asciidoctor.extension.InlineMacroProcessor;
|
import org.asciidoctor.extension.InlineMacroProcessor;
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usage in asciidoc:
|
* Usage in asciidoc:
|
||||||
* <p>
|
* <p>
|
||||||
* webWolfLink:here[] will display a href with here as text
|
* webWolfLink:here[] will display a href with here as text
|
||||||
* webWolfLink:landing[noLink] will display the complete url, for example: http://WW_HOST:WW_PORT/landing
|
|
||||||
*/
|
*/
|
||||||
public class WebWolfMacro extends InlineMacroProcessor {
|
public class WebWolfMacro extends InlineMacroProcessor {
|
||||||
|
|
||||||
|
public WebWolfMacro(String macroName) {
|
||||||
|
super(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
public WebWolfMacro(String macroName, Map<String, Object> config) {
|
public WebWolfMacro(String macroName, Map<String, Object> config) {
|
||||||
super(macroName, config);
|
super(macroName, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String process(AbstractBlock parent, String target, Map<String, Object> attributes) {
|
public Object process(ContentNode contentNode, String linkText, Map<String, Object> attributes) {
|
||||||
Environment env = EnvironmentExposure.getEnv();
|
var env = EnvironmentExposure.getEnv();
|
||||||
String hostname = determineHost(env.getProperty("webwolf.host"), env.getProperty("webwolf.port"));
|
var hostname = determineHost(env.getProperty("webwolf.host"), env.getProperty("webwolf.port"));
|
||||||
|
var target = (String) attributes.getOrDefault("target", "home");
|
||||||
|
var href = hostname + "/" + target;
|
||||||
|
|
||||||
|
//are we using noLink in webWolfLink:landing[noLink]? Then display link with full href
|
||||||
if (displayCompleteLinkNoFormatting(attributes)) {
|
if (displayCompleteLinkNoFormatting(attributes)) {
|
||||||
return hostname + (hostname.endsWith("/") ? "" : "/") + target;
|
linkText = href;
|
||||||
}
|
}
|
||||||
return "<a href=\"" + hostname + "\" target=\"_blank\">" + target + "</a>";
|
|
||||||
|
var options = new HashMap<String, Object>();
|
||||||
|
options.put("type", ":link");
|
||||||
|
options.put("target", href);
|
||||||
|
attributes.put("window", "_blank");
|
||||||
|
return createPhraseNode(contentNode, "anchor", linkText, attributes, options).convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean displayCompleteLinkNoFormatting(Map<String, Object> attributes) {
|
private boolean displayCompleteLinkNoFormatting(Map<String, Object> attributes) {
|
||||||
@ -47,7 +58,7 @@ public class WebWolfMacro extends InlineMacroProcessor {
|
|||||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||||
host = request.getHeader("Host");
|
host = request.getHeader("Host");
|
||||||
int semicolonIndex = host.indexOf(":");
|
int semicolonIndex = host.indexOf(":");
|
||||||
if (semicolonIndex==-1 || host.endsWith(":80")) {
|
if (semicolonIndex == -1 || host.endsWith(":80")) {
|
||||||
host = host.replace(":80", "").replace("www.webgoat.local", "www.webwolf.local");
|
host = host.replace(":80", "").replace("www.webgoat.local", "www.webwolf.local");
|
||||||
} else {
|
} else {
|
||||||
host = host.substring(0, semicolonIndex);
|
host = host.substring(0, semicolonIndex);
|
||||||
|
@ -10,6 +10,10 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class WebWolfRootMacro extends WebWolfMacro {
|
public class WebWolfRootMacro extends WebWolfMacro {
|
||||||
|
|
||||||
|
public WebWolfRootMacro(String macroName) {
|
||||||
|
super(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
public WebWolfRootMacro(String macroName, Map<String, Object> config) {
|
public WebWolfRootMacro(String macroName, Map<String, Object> config) {
|
||||||
super(macroName, config);
|
super(macroName, config);
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ public enum Category {
|
|||||||
XSS("(A7) Cross-Site Scripting (XSS)", 307),
|
XSS("(A7) Cross-Site Scripting (XSS)", 307),
|
||||||
INSECURE_DESERIALIZATION("(A8) Insecure Deserialization", 308),
|
INSECURE_DESERIALIZATION("(A8) Insecure Deserialization", 308),
|
||||||
VULNERABLE_COMPONENTS("(A9) Vulnerable Components", 309),
|
VULNERABLE_COMPONENTS("(A9) Vulnerable Components", 309),
|
||||||
|
SESSION_MANAGEMENT("(A10) Session Management Flaws", 310),
|
||||||
|
|
||||||
REQUEST_FORGERIES("(A8:2013) Request Forgeries", 318),
|
REQUEST_FORGERIES("(A8:2013) Request Forgeries", 318),
|
||||||
|
|
||||||
@ -66,7 +67,6 @@ public enum Category {
|
|||||||
DOS("Denial of Service", 1500),
|
DOS("Denial of Service", 1500),
|
||||||
MALICIOUS_EXECUTION("Malicious Execution", 1600),
|
MALICIOUS_EXECUTION("Malicious Execution", 1600),
|
||||||
CLIENT_SIDE("Client side", 1700),
|
CLIENT_SIDE("Client side", 1700),
|
||||||
SESSION_MANAGEMENT("Session Management Flaws", 1800),
|
|
||||||
WEB_SERVICES("Web Services", 1900),
|
WEB_SERVICES("Web Services", 1900),
|
||||||
ADMIN_FUNCTIONS("Admin Functions", 2000),
|
ADMIN_FUNCTIONS("Admin Functions", 2000),
|
||||||
CHALLENGE("Challenges", 3000);
|
CHALLENGE("Challenges", 3000);
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package org.owasp.webgoat.lessons;
|
||||||
|
|
||||||
|
import org.owasp.webgoat.users.WebGoatUser;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler which sets the correct schema for the currently bounded user. This way users are not seeing each other
|
||||||
|
* data and we can reset data for just one particular user.
|
||||||
|
*/
|
||||||
|
public class LessonConnectionInvocationHandler implements InvocationHandler {
|
||||||
|
|
||||||
|
private final Connection targetConnection;
|
||||||
|
|
||||||
|
public LessonConnectionInvocationHandler(Connection targetConnection) {
|
||||||
|
this.targetConnection = targetConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
|
var authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
if (authentication != null && authentication.getPrincipal() instanceof WebGoatUser) {
|
||||||
|
var user = (WebGoatUser) authentication.getPrincipal();
|
||||||
|
targetConnection.createStatement().execute("SET SCHEMA \"" + user.getUsername() + "\"");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return method.invoke(targetConnection, args);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
throw e.getTargetException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -36,6 +36,8 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -43,7 +45,7 @@ public class RestartLessonService {
|
|||||||
|
|
||||||
private final WebSession webSession;
|
private final WebSession webSession;
|
||||||
private final UserTrackerRepository userTrackerRepository;
|
private final UserTrackerRepository userTrackerRepository;
|
||||||
private final Flyway flywayLessons;
|
private final Function<String, Flyway> flywayLessons;
|
||||||
|
|
||||||
@RequestMapping(path = "/service/restartlesson.mvc", produces = "text/text")
|
@RequestMapping(path = "/service/restartlesson.mvc", produces = "text/text")
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@ -55,7 +57,8 @@ public class RestartLessonService {
|
|||||||
userTracker.reset(al);
|
userTracker.reset(al);
|
||||||
userTrackerRepository.save(userTracker);
|
userTrackerRepository.save(userTracker);
|
||||||
|
|
||||||
flywayLessons.clean();
|
var flyway = flywayLessons.apply(webSession.getUserName());
|
||||||
flywayLessons.migrate();
|
flyway.clean();
|
||||||
|
flyway.migrate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,6 @@ public interface UserRepository extends JpaRepository<WebGoatUser, String> {
|
|||||||
|
|
||||||
List<WebGoatUser> findAll();
|
List<WebGoatUser> findAll();
|
||||||
|
|
||||||
|
boolean existsByUsername(String username);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
package org.owasp.webgoat.users;
|
package org.owasp.webgoat.users;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.flywaydb.core.Flyway;
|
||||||
|
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
||||||
|
import org.owasp.webgoat.session.WebSession;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nbaars
|
* @author nbaars
|
||||||
@ -17,6 +22,8 @@ public class UserService implements UserDetailsService {
|
|||||||
|
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
private final UserTrackerRepository userTrackerRepository;
|
private final UserTrackerRepository userTrackerRepository;
|
||||||
|
private final JdbcTemplate jdbcTemplate;
|
||||||
|
private final Function<String, Flyway> flywayLessons;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WebGoatUser loadUserByUsername(String username) throws UsernameNotFoundException {
|
public WebGoatUser loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
@ -31,24 +38,18 @@ public class UserService implements UserDetailsService {
|
|||||||
|
|
||||||
public void addUser(String username, String password) {
|
public void addUser(String username, String password) {
|
||||||
//get user if there exists one by the name
|
//get user if there exists one by the name
|
||||||
WebGoatUser webGoatUser = userRepository.findByUsername(username);
|
var userAlreadyExists = userRepository.existsByUsername(username);
|
||||||
//if user exists it will be updated, otherwise created
|
var webGoatUser = userRepository.save(new WebGoatUser(username, password));
|
||||||
userRepository.save(new WebGoatUser(username, password));
|
|
||||||
//if user previously existed it will not get another tracker
|
if (!userAlreadyExists) {
|
||||||
if (webGoatUser == null) {
|
userTrackerRepository.save(new UserTracker(username)); //if user previously existed it will not get another tracker
|
||||||
userTrackerRepository.save(new UserTracker(username));
|
createLessonsForUser(webGoatUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUser(String username, String password, String role) {
|
private void createLessonsForUser(WebGoatUser webGoatUser) {
|
||||||
//get user if there exists one by the name
|
jdbcTemplate.execute("CREATE SCHEMA \"" + webGoatUser.getUsername() + "\" authorization dba");
|
||||||
WebGoatUser webGoatUser = userRepository.findByUsername(username);
|
flywayLessons.apply(webGoatUser.getUsername()).migrate();
|
||||||
//if user exists it will be updated, otherwise created
|
|
||||||
userRepository.save(new WebGoatUser(username, password, role));
|
|
||||||
//if user previously existed it will not get another tracker
|
|
||||||
if (webGoatUser == null) {
|
|
||||||
userTrackerRepository.save(new UserTracker(username));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WebGoatUser> getAllUsers() {
|
public List<WebGoatUser> getAllUsers() {
|
||||||
|
@ -34,15 +34,14 @@ public class WebGoatUser implements UserDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WebGoatUser(String username, String password) {
|
public WebGoatUser(String username, String password) {
|
||||||
this.username = username;
|
this(username, password, ROLE_USER);
|
||||||
this.password = password;
|
|
||||||
createUser();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebGoatUser(String username, String password, String role) {
|
public WebGoatUser(String username, String password, String role) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
createUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ webgoat.default.language=en
|
|||||||
webwolf.host=${WEBWOLF_HOST:127.0.0.1}
|
webwolf.host=${WEBWOLF_HOST:127.0.0.1}
|
||||||
webwolf.port=${WEBWOLF_PORT:9090}
|
webwolf.port=${WEBWOLF_PORT:9090}
|
||||||
webwolf.url=http://${webwolf.host}:${webwolf.port}/WebWolf
|
webwolf.url=http://${webwolf.host}:${webwolf.port}/WebWolf
|
||||||
webwolf.url.landingpage=http://${webwolf.host}:${webwolf.port}/landing
|
webwolf.landingpage.url=http://${webwolf.host}:${webwolf.port}/landing
|
||||||
webwolf.url.mail=http://${webwolf.host}:${webwolf.port}/mail
|
webwolf.mail.url=http://${webwolf.host}:${webwolf.port}/mail
|
||||||
|
|
||||||
spring.jackson.serialization.indent_output=true
|
spring.jackson.serialization.indent_output=true
|
||||||
spring.jackson.serialization.write-dates-as-timestamps=false
|
spring.jackson.serialization.write-dates-as-timestamps=false
|
||||||
@ -56,3 +56,7 @@ exclude.categories=${EXCLUDE_CATEGORIES:none,none}
|
|||||||
|
|
||||||
exclude.lessons=${EXCLUDE_LESSONS:none,none}
|
exclude.lessons=${EXCLUDE_LESSONS:none,none}
|
||||||
#exclude based on the class name of a lesson e.g.: LessonTemplate
|
#exclude based on the class name of a lesson e.g.: LessonTemplate
|
||||||
|
|
||||||
|
management.health.db.enabled=true
|
||||||
|
management.endpoint.health.show-details=always
|
||||||
|
management.endpoints.web.exposure.include=health,configprops
|
||||||
|
BIN
webgoat-container/src/main/resources/static/css/img/favicon.ico
Normal file
BIN
webgoat-container/src/main/resources/static/css/img/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -1,33 +0,0 @@
|
|||||||
/* css for lessons */
|
|
||||||
/* not efficient loading, but at least easier to maintain */
|
|
||||||
|
|
||||||
.hidden-menu-item {
|
|
||||||
display:none;
|
|
||||||
visibility:hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ac-menu li {
|
|
||||||
list-style-type: none;
|
|
||||||
background-color: #aaa;
|
|
||||||
width: auto;
|
|
||||||
max-width: 20%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ac-menu li:hover {
|
|
||||||
color: white;
|
|
||||||
background-color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ac-menu div {
|
|
||||||
margin-bottom: -60px;
|
|
||||||
margin-top: -10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ac-menu h3 {
|
|
||||||
color:white;
|
|
||||||
background-color:#666;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ac-menu-wrapper {
|
|
||||||
border-bottom: 2px solid #444;
|
|
||||||
}
|
|
@ -2,6 +2,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<title th:text="#{login.page.title}">Login Page</title>
|
<title th:text="#{login.page.title}">Login Page</title>
|
||||||
|
<link rel="shortcut icon" th:href="@{/css/img/favicon.ico}" type="image/x-icon"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/plugins/bootstrap/css/bootstrap.min.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/plugins/bootstrap/css/bootstrap.min.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
|
||||||
|
@ -8,14 +8,13 @@
|
|||||||
<meta http-equiv="Cache-Control" CONTENT="no-store"/>
|
<meta http-equiv="Cache-Control" CONTENT="no-store"/>
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<link rel="shortcut icon" th:href="@{/images/favicon.ico}" type="image/x-icon"/>
|
<link rel="shortcut icon" th:href="@{/css/img/favicon.ico}" type="image/x-icon"/>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/plugins/bootstrap/css/bootstrap.min.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/plugins/bootstrap/css/bootstrap.min.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/animate.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/css/animate.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/coderay.css}"/>
|
<link rel="stylesheet" type="text/css" th:href="@{/css/coderay.css}"/>
|
||||||
<link rel="stylesheet" type="text/css" th:href="@{/css/lessons.css}"/>
|
|
||||||
<!-- <link rel="stylesheet" type="text/css" th:href="@{/css/asciidoctor-default.css}"/>-->
|
<!-- <link rel="stylesheet" type="text/css" th:href="@{/css/asciidoctor-default.css}"/>-->
|
||||||
|
|
||||||
<!-- end of CSS -->
|
<!-- end of CSS -->
|
||||||
|
@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
@ -14,14 +15,19 @@ import java.sql.SQLException;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class TestApplication {
|
public class TestApplication {
|
||||||
|
|
||||||
|
@Value("${spring.datasource.driver-class-name}")
|
||||||
|
private String driverClassName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We define our own datasource, otherwise we end up with Hikari one which for some lessons will
|
* We define our own datasource, otherwise we end up with Hikari one which for some lessons will
|
||||||
* throw an error (feature not supported)
|
* throw an error (feature not supported)
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "webgoat.start", name = "hsqldb", havingValue = "false")
|
@ConditionalOnProperty(prefix = "webgoat.start", name = "hsqldb", havingValue = "false")
|
||||||
|
@Primary
|
||||||
public DataSource dataSource(@Value("${spring.datasource.url}") String url) throws SQLException {
|
public DataSource dataSource(@Value("${spring.datasource.url}") String url) throws SQLException {
|
||||||
DriverManager.registerDriver(new JDBCDriver());
|
DriverManager.registerDriver(new JDBCDriver());
|
||||||
return new DriverManagerDataSource(url);
|
return new DriverManagerDataSource(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import org.springframework.web.servlet.i18n.FixedLocaleResolver;
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
//Do not remove is the base class for all assignments tests
|
||||||
public class AssignmentEndpointTest {
|
public class AssignmentEndpointTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@ -59,7 +60,6 @@ public class AssignmentEndpointTest {
|
|||||||
|
|
||||||
public void init(AssignmentEndpoint a) {
|
public void init(AssignmentEndpoint a) {
|
||||||
messages.setBasenames("classpath:/i18n/messages", "classpath:/i18n/WebGoatLabels");
|
messages.setBasenames("classpath:/i18n/messages", "classpath:/i18n/WebGoatLabels");
|
||||||
ReflectionTestUtils.setField(a, "userTrackerRepository", userTrackerRepository);
|
|
||||||
ReflectionTestUtils.setField(a, "userSessionData", userSessionData);
|
ReflectionTestUtils.setField(a, "userSessionData", userSessionData);
|
||||||
ReflectionTestUtils.setField(a, "webSession", webSession);
|
ReflectionTestUtils.setField(a, "webSession", webSession);
|
||||||
ReflectionTestUtils.setField(a, "messages", pluginMessages);
|
ReflectionTestUtils.setField(a, "messages", pluginMessages);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.owasp.webgoat.plugins;
|
package org.owasp.webgoat.plugins;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.flywaydb.core.Flyway;
|
||||||
|
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.owasp.webgoat.i18n.Language;
|
import org.owasp.webgoat.i18n.Language;
|
||||||
import org.owasp.webgoat.i18n.PluginMessages;
|
import org.owasp.webgoat.i18n.PluginMessages;
|
||||||
import org.owasp.webgoat.session.WebSession;
|
import org.owasp.webgoat.session.WebSession;
|
||||||
@ -12,7 +14,9 @@ import org.springframework.test.context.TestPropertySource;
|
|||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@ -31,16 +35,25 @@ public abstract class LessonTest {
|
|||||||
protected WebApplicationContext wac;
|
protected WebApplicationContext wac;
|
||||||
@Autowired
|
@Autowired
|
||||||
protected PluginMessages messages;
|
protected PluginMessages messages;
|
||||||
|
@Autowired
|
||||||
|
private Function<String, Flyway> flywayLessons;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected WebSession webSession;
|
protected WebSession webSession;
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
private Language language;
|
private Language language;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void init() {
|
void init() {
|
||||||
when(webSession.getUserName()).thenReturn("unit-test");
|
when(webSession.getUserName()).thenReturn("unit-test");
|
||||||
when(language.getLocale()).thenReturn(Locale.getDefault());
|
when(language.getLocale()).thenReturn(Locale.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void createFlywayLessonTables() {
|
||||||
|
flywayLessons.apply("PUBLIC").migrate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
package org.owasp.webgoat.plugins;
|
|
||||||
|
|
||||||
public class PluginTest {
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
// public void pathShouldBeRewrittenInHtmlFile() throws Exception {
|
|
||||||
// Path tmpDir = PluginTestHelper.createTmpDir();
|
|
||||||
// Path pluginSourcePath = PluginTestHelper.pathForLoading();
|
|
||||||
// Plugin plugin = PluginTestHelper.createPluginFor(TestPlugin.class);
|
|
||||||
// Path htmlFile = Paths.get(pluginSourcePath.toString(), "lessonSolutions", "rewrite_test.html");
|
|
||||||
// plugin.loadFiles(Arrays.asList(htmlFile), true);
|
|
||||||
// plugin.rewritePaths(tmpDir);
|
|
||||||
// List<String> allLines = Files.readAllLines(htmlFile, StandardCharsets.UTF_8);
|
|
||||||
//
|
|
||||||
// assertThat(allLines,
|
|
||||||
// hasItem(containsString("plugin/TestPlugin/lessonSolutions/en/TestPlugin_files/image001.png")));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void shouldNotRewriteOtherLinks() throws Exception {
|
|
||||||
// Path tmpDir = PluginTestHelper.createTmpDir();
|
|
||||||
// Path pluginSourcePath = PluginTestHelper.pathForLoading();
|
|
||||||
// Plugin plugin = PluginTestHelper.createPluginFor(TestPlugin.class);
|
|
||||||
// Path htmlFile = Paths.get(pluginSourcePath.toString(), "lessonSolutions", "rewrite_test.html");
|
|
||||||
// plugin.loadFiles(Arrays.asList(htmlFile), true);
|
|
||||||
// plugin.rewritePaths(tmpDir);
|
|
||||||
// List<String> allLines = Files.readAllLines(htmlFile, StandardCharsets.UTF_8);
|
|
||||||
//
|
|
||||||
// assertThat(allLines,
|
|
||||||
// hasItem(containsString("Unknown_files/image001.png")));
|
|
||||||
// }
|
|
||||||
}
|
|
@ -2,28 +2,25 @@ package org.owasp.webgoat.service;
|
|||||||
|
|
||||||
import com.beust.jcommander.internal.Lists;
|
import com.beust.jcommander.internal.Lists;
|
||||||
import org.hamcrest.CoreMatchers;
|
import org.hamcrest.CoreMatchers;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.owasp.webgoat.lessons.Lesson;
|
|
||||||
import org.owasp.webgoat.lessons.Assignment;
|
import org.owasp.webgoat.lessons.Assignment;
|
||||||
|
import org.owasp.webgoat.lessons.Lesson;
|
||||||
import org.owasp.webgoat.session.WebSession;
|
import org.owasp.webgoat.session.WebSession;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.owasp.webgoat.service.HintService.URL_HINTS_MVC;
|
import static org.owasp.webgoat.service.HintService.URL_HINTS_MVC;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
|
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class HintServiceTest {
|
public class HintServiceTest {
|
||||||
|
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
@ -34,13 +31,13 @@ public class HintServiceTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private Assignment assignment;
|
private Assignment assignment;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
void setup() {
|
||||||
this.mockMvc = standaloneSetup(new HintService(websession)).build();
|
this.mockMvc = standaloneSetup(new HintService(websession)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void hintsPerAssignment() throws Exception {
|
void hintsPerAssignment() throws Exception {
|
||||||
Assignment assignment = Mockito.mock(Assignment.class);
|
Assignment assignment = Mockito.mock(Assignment.class);
|
||||||
when(assignment.getPath()).thenReturn("/HttpBasics/attack1");
|
when(assignment.getPath()).thenReturn("/HttpBasics/attack1");
|
||||||
when(assignment.getHints()).thenReturn(Lists.newArrayList("hint 1", "hint 2"));
|
when(assignment.getHints()).thenReturn(Lists.newArrayList("hint 1", "hint 2"));
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package org.owasp.webgoat.service;
|
package org.owasp.webgoat.service;
|
||||||
|
|
||||||
import org.hamcrest.CoreMatchers;
|
import org.hamcrest.CoreMatchers;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.owasp.webgoat.assignments.LessonTrackerInterceptor;
|
import org.owasp.webgoat.assignments.LessonTrackerInterceptor;
|
||||||
import org.owasp.webgoat.session.Course;
|
|
||||||
import org.owasp.webgoat.users.UserService;
|
import org.owasp.webgoat.users.UserService;
|
||||||
|
import org.owasp.webgoat.users.UserTrackerRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.security.test.context.support.WithMockUser;
|
import org.springframework.security.test.context.support.WithMockUser;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
@ -48,15 +47,21 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
* @since November 29, 2016
|
* @since November 29, 2016
|
||||||
*/
|
*/
|
||||||
@WebMvcTest(value = {LabelService.class})
|
@WebMvcTest(value = {LabelService.class})
|
||||||
@RunWith(SpringRunner.class)
|
@ActiveProfiles({"test", "webgoat"})
|
||||||
public class LabelServiceTest {
|
class LabelServiceTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public MockMvc mockMvc;
|
public MockMvc mockMvc;
|
||||||
|
@MockBean
|
||||||
|
private UserService userService;
|
||||||
|
@MockBean
|
||||||
|
private UserTrackerRepository userTrackerRepository;
|
||||||
|
@MockBean
|
||||||
|
private LessonTrackerInterceptor lessonTrackerInterceptor;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithMockUser(username = "guest", password = "guest")
|
@WithMockUser(username = "guest", password = "guest")
|
||||||
public void withoutLocale() throws Exception {
|
void withoutLocale() throws Exception {
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get(URL_LABELS_MVC))
|
mockMvc.perform(MockMvcRequestBuilders.get(URL_LABELS_MVC))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("password", CoreMatchers.is("Password")));
|
.andExpect(jsonPath("password", CoreMatchers.is("Password")));
|
||||||
@ -64,7 +69,7 @@ public class LabelServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithMockUser(username = "guest", password = "guest")
|
@WithMockUser(username = "guest", password = "guest")
|
||||||
public void withLocale() throws Exception {
|
void withLocale() throws Exception {
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get(URL_LABELS_MVC).param("lang", "nl"))
|
mockMvc.perform(MockMvcRequestBuilders.get(URL_LABELS_MVC).param("lang", "nl"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("password", CoreMatchers.is("Wachtwoord")));
|
.andExpect(jsonPath("password", CoreMatchers.is("Wachtwoord")));
|
||||||
|
@ -23,12 +23,12 @@ package org.owasp.webgoat.service;
|
|||||||
|
|
||||||
import com.beust.jcommander.internal.Lists;
|
import com.beust.jcommander.internal.Lists;
|
||||||
import org.hamcrest.CoreMatchers;
|
import org.hamcrest.CoreMatchers;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.owasp.webgoat.lessons.Category;
|
import org.owasp.webgoat.lessons.Category;
|
||||||
import org.owasp.webgoat.lessons.Lesson;
|
import org.owasp.webgoat.lessons.Lesson;
|
||||||
import org.owasp.webgoat.session.Course;
|
import org.owasp.webgoat.session.Course;
|
||||||
@ -39,6 +39,8 @@ import org.owasp.webgoat.users.UserTrackerRepository;
|
|||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.owasp.webgoat.service.LessonMenuService.URL_LESSONMENU_MVC;
|
import static org.owasp.webgoat.service.LessonMenuService.URL_LESSONMENU_MVC;
|
||||||
@ -47,9 +49,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
|
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
|
||||||
|
|
||||||
import java.util.Arrays;
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
|
||||||
public class LessonMenuServiceTest {
|
public class LessonMenuServiceTest {
|
||||||
|
|
||||||
@Mock(lenient=true)
|
@Mock(lenient=true)
|
||||||
@ -64,13 +64,13 @@ public class LessonMenuServiceTest {
|
|||||||
private WebSession webSession;
|
private WebSession webSession;
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
void setup() {
|
||||||
this.mockMvc = standaloneSetup(new LessonMenuService(course, webSession, userTrackerRepository, Arrays.asList("none"), Arrays.asList("none"))).build();
|
this.mockMvc = standaloneSetup(new LessonMenuService(course, webSession, userTrackerRepository, Arrays.asList("none"), Arrays.asList("none"))).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void lessonsShouldBeOrdered() throws Exception {
|
void lessonsShouldBeOrdered() throws Exception {
|
||||||
Lesson l1 = Mockito.mock(Lesson.class);
|
Lesson l1 = Mockito.mock(Lesson.class);
|
||||||
Lesson l2 = Mockito.mock(Lesson.class);
|
Lesson l2 = Mockito.mock(Lesson.class);
|
||||||
when(l1.getTitle()).thenReturn("ZA");
|
when(l1.getTitle()).thenReturn("ZA");
|
||||||
@ -88,7 +88,7 @@ public class LessonMenuServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void lessonCompleted() throws Exception {
|
void lessonCompleted() throws Exception {
|
||||||
Lesson l1 = Mockito.mock(Lesson.class);
|
Lesson l1 = Mockito.mock(Lesson.class);
|
||||||
when(l1.getTitle()).thenReturn("ZA");
|
when(l1.getTitle()).thenReturn("ZA");
|
||||||
when(lessonTracker.isLessonSolved()).thenReturn(true);
|
when(lessonTracker.isLessonSolved()).thenReturn(true);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package org.owasp.webgoat.service;
|
package org.owasp.webgoat.service;
|
||||||
|
|
||||||
import org.assertj.core.util.Maps;
|
import org.assertj.core.util.Maps;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.owasp.webgoat.lessons.Lesson;
|
import org.owasp.webgoat.lessons.Lesson;
|
||||||
import org.owasp.webgoat.lessons.Assignment;
|
import org.owasp.webgoat.lessons.Assignment;
|
||||||
import org.owasp.webgoat.session.WebSession;
|
import org.owasp.webgoat.session.WebSession;
|
||||||
@ -54,8 +54,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
* @version $Id: $Id
|
* @version $Id: $Id
|
||||||
* @since November 25, 2016
|
* @since November 25, 2016
|
||||||
*/
|
*/
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class LessonProgressServiceTest {
|
class LessonProgressServiceTest {
|
||||||
|
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
@ -70,8 +70,8 @@ public class LessonProgressServiceTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private WebSession websession;
|
private WebSession websession;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
void setup() {
|
||||||
Assignment assignment = new Assignment("test", "test", List.of());
|
Assignment assignment = new Assignment("test", "test", List.of());
|
||||||
when(userTrackerRepository.findByUser(any())).thenReturn(userTracker);
|
when(userTrackerRepository.findByUser(any())).thenReturn(userTracker);
|
||||||
when(userTracker.getLessonTracker(any(Lesson.class))).thenReturn(lessonTracker);
|
when(userTracker.getLessonTracker(any(Lesson.class))).thenReturn(lessonTracker);
|
||||||
@ -82,7 +82,7 @@ public class LessonProgressServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void jsonLessonOverview() throws Exception {
|
void jsonLessonOverview() throws Exception {
|
||||||
this.mockMvc.perform(MockMvcRequestBuilders.get("/service/lessonoverview.mvc").accept(MediaType.APPLICATION_JSON_VALUE))
|
this.mockMvc.perform(MockMvcRequestBuilders.get("/service/lessonoverview.mvc").accept(MediaType.APPLICATION_JSON_VALUE))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$[0].assignment.name", is("test")))
|
.andExpect(jsonPath("$[0].assignment.name", is("test")))
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.owasp.webgoat.service;
|
package org.owasp.webgoat.service;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.owasp.webgoat.i18n.PluginMessages;
|
import org.owasp.webgoat.i18n.PluginMessages;
|
||||||
import org.owasp.webgoat.lessons.Lesson;
|
import org.owasp.webgoat.lessons.Lesson;
|
||||||
import org.owasp.webgoat.session.Course;
|
import org.owasp.webgoat.session.Course;
|
||||||
@ -26,7 +26,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
|
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class ReportCardServiceTest {
|
public class ReportCardServiceTest {
|
||||||
|
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
@ -45,15 +45,15 @@ public class ReportCardServiceTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private PluginMessages pluginMessages;
|
private PluginMessages pluginMessages;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
void setup() {
|
||||||
this.mockMvc = standaloneSetup(new ReportCardService(websession, userTrackerRepository, course, pluginMessages)).build();
|
this.mockMvc = standaloneSetup(new ReportCardService(websession, userTrackerRepository, course, pluginMessages)).build();
|
||||||
when(pluginMessages.getMessage(anyString())).thenReturn("Test");
|
when(pluginMessages.getMessage(anyString())).thenReturn("Test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithMockUser(username = "guest", password = "guest")
|
@WithMockUser(username = "guest", password = "guest")
|
||||||
public void withLessons() throws Exception {
|
void withLessons() throws Exception {
|
||||||
when(lesson.getTitle()).thenReturn("Test");
|
when(lesson.getTitle()).thenReturn("Test");
|
||||||
when(course.getTotalOfLessons()).thenReturn(1);
|
when(course.getTotalOfLessons()).thenReturn(1);
|
||||||
when(course.getTotalOfAssignments()).thenReturn(10);
|
when(course.getTotalOfAssignments()).thenReturn(10);
|
||||||
|
@ -1,45 +1,43 @@
|
|||||||
package org.owasp.webgoat.session;
|
package org.owasp.webgoat.session;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.assertj.core.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
class LabelDebuggerTest {
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
public class LabelDebuggerTest {
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetEnabledTrue() throws Exception {
|
void testSetEnabledTrue() {
|
||||||
LabelDebugger ld = new LabelDebugger();
|
LabelDebugger ld = new LabelDebugger();
|
||||||
ld.setEnabled(true);
|
ld.setEnabled(true);
|
||||||
assertTrue(ld.isEnabled());
|
Assertions.assertThat(ld.isEnabled()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetEnabledFalse() throws Exception {
|
void testSetEnabledFalse() {
|
||||||
LabelDebugger ld = new LabelDebugger();
|
LabelDebugger ld = new LabelDebugger();
|
||||||
ld.setEnabled(false);
|
ld.setEnabled(false);
|
||||||
assertFalse(ld.isEnabled());
|
Assertions.assertThat((ld.isEnabled())).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetEnabledNullThrowsException() {
|
void testSetEnabledNullThrowsException() {
|
||||||
LabelDebugger ld = new LabelDebugger();
|
LabelDebugger ld = new LabelDebugger();
|
||||||
ld.setEnabled(true);
|
ld.setEnabled(true);
|
||||||
assertTrue(ld.isEnabled());
|
Assertions.assertThat((ld.isEnabled())).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEnableIsTrue() {
|
void testEnableIsTrue() {
|
||||||
LabelDebugger ld = new LabelDebugger();
|
LabelDebugger ld = new LabelDebugger();
|
||||||
ld.enable();
|
ld.enable();
|
||||||
assertTrue(ld.isEnabled());
|
Assertions.assertThat((ld.isEnabled())).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDisableIsFalse() {
|
void testDisableIsFalse() {
|
||||||
LabelDebugger ld = new LabelDebugger();
|
LabelDebugger ld = new LabelDebugger();
|
||||||
ld.disable();
|
ld.disable();
|
||||||
assertFalse(ld.isEnabled());
|
Assertions.assertThat((ld.isEnabled())).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.owasp.webgoat.session;
|
package org.owasp.webgoat.session;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.assertj.core.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.owasp.webgoat.lessons.Assignment;
|
import org.owasp.webgoat.lessons.Assignment;
|
||||||
import org.owasp.webgoat.lessons.Lesson;
|
import org.owasp.webgoat.lessons.Lesson;
|
||||||
import org.owasp.webgoat.users.LessonTracker;
|
import org.owasp.webgoat.users.LessonTracker;
|
||||||
@ -9,7 +10,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@ -42,20 +42,20 @@ import static org.mockito.Mockito.when;
|
|||||||
* @version $Id: $Id
|
* @version $Id: $Id
|
||||||
* @since November 25, 2016
|
* @since November 25, 2016
|
||||||
*/
|
*/
|
||||||
public class LessonTrackerTest {
|
class LessonTrackerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void allAssignmentsSolvedShouldMarkLessonAsComplete() {
|
void allAssignmentsSolvedShouldMarkLessonAsComplete() {
|
||||||
Lesson lesson = mock(Lesson.class);
|
Lesson lesson = mock(Lesson.class);
|
||||||
when(lesson.getAssignments()).thenReturn(List.of(new Assignment("assignment", "assignment", List.of(""))));
|
when(lesson.getAssignments()).thenReturn(List.of(new Assignment("assignment", "assignment", List.of(""))));
|
||||||
LessonTracker lessonTracker = new LessonTracker(lesson);
|
LessonTracker lessonTracker = new LessonTracker(lesson);
|
||||||
lessonTracker.assignmentSolved("assignment");
|
lessonTracker.assignmentSolved("assignment");
|
||||||
|
|
||||||
assertTrue(lessonTracker.isLessonSolved());
|
Assertions.assertThat(lessonTracker.isLessonSolved()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void noAssignmentsSolvedShouldMarkLessonAsInComplete() {
|
void noAssignmentsSolvedShouldMarkLessonAsInComplete() {
|
||||||
Lesson lesson = mock(Lesson.class);
|
Lesson lesson = mock(Lesson.class);
|
||||||
Assignment a1 = new Assignment("a1");
|
Assignment a1 = new Assignment("a1");
|
||||||
Assignment a2 = new Assignment("a2");
|
Assignment a2 = new Assignment("a2");
|
||||||
@ -70,7 +70,7 @@ public class LessonTrackerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void solvingSameAssignmentShouldNotAddItTwice() {
|
void solvingSameAssignmentShouldNotAddItTwice() {
|
||||||
Lesson lesson = mock(Lesson.class);
|
Lesson lesson = mock(Lesson.class);
|
||||||
Assignment a1 = new Assignment("a1");
|
Assignment a1 = new Assignment("a1");
|
||||||
List<Assignment> assignments = List.of(a1);
|
List<Assignment> assignments = List.of(a1);
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
package org.owasp.webgoat.users;
|
package org.owasp.webgoat.users;
|
||||||
|
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@DataJpaTest
|
@DataJpaTest
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@ActiveProfiles({"test", "webgoat"})
|
@ActiveProfiles({"test", "webgoat"})
|
||||||
public class UserRepositoryTest {
|
class UserRepositoryTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void userShouldBeSaved() {
|
void userShouldBeSaved() {
|
||||||
WebGoatUser user = new WebGoatUser("test", "password");
|
WebGoatUser user = new WebGoatUser("test", "password");
|
||||||
userRepository.saveAndFlush(user);
|
userRepository.saveAndFlush(user);
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user