Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
8219842
Corrected typos and poor grammar found in the SQL Injection lessons.
Apr 1, 2021
721edc9
Move WebGoat to Java 15
nbaars Apr 2, 2021
3e8dbc9
Run build on pull requests as well
nbaars Apr 2, 2021
abf431f
Remove unnecessary plugins in subprojects
nbaars Apr 2, 2021
ee1d4b0
Update documentation for Java 15
nbaars Apr 2, 2021
b76330f
Add minimal Maven version
nbaars Mar 31, 2021
b858484
Copy jar files to target so they are not stored in the current projec…
nbaars Mar 31, 2021
b3f7a53
Update to latest versions
nbaars Mar 31, 2021
5d45fd6
Update Checkstyle version
nbaars Apr 1, 2021
d0f36f5
Fix failing XXE test
nbaars Apr 3, 2021
94f79f8
Remove platform dependent deployments
nbaars Apr 3, 2021
0e92e6c
Remove Vagrant image
nbaars Apr 3, 2021
ec5930e
Remove docker-compose files
nbaars Apr 3, 2021
28978bc
Remove all scripts
nbaars Apr 3, 2021
3740a5a
Remove documentation about Docker compose and stack from README
nbaars Apr 3, 2021
fd922a3
Remove obsolete Docker configuration
nbaars Apr 3, 2021
d2445d7
Update Dockerfile
nbaars Apr 3, 2021
1d38bf6
Create main.yml
HammerHam Aug 4, 2021
166ac47
Create Jenkinsfile
HammerHam Dec 27, 2021
dc3886d
Delete node { stage('SCM') { checkout scm } stage('SonarQub…
HammerHam Dec 27, 2021
3704c23
Create Jenkinsfile
HammerHam Dec 27, 2021
14b7a37
Update Jenkinsfile
HammerHam Dec 27, 2021
8811fd5
Create jenkinsfile
HammerHam Dec 27, 2021
054efc1
Update Jenkinsfile
HammerHam Dec 28, 2021
00fa190
Update Jenkinsfile
HammerHam Dec 28, 2021
0ba935f
Update Jenkinsfile
HammerHam Dec 28, 2021
53cf77e
Update Jenkinsfile
HammerHam Dec 28, 2021
91e265a
Update Jenkinsfile
HammerHam Dec 28, 2021
94631a3
Update Jenkinsfile
HammerHam Dec 28, 2021
a42d1da
Create build.yml
HammerHam Dec 28, 2021
7242f74
Update build.yml
HammerHam Dec 28, 2021
c64d856
Update build.yml
HammerHam Dec 28, 2021
83c6204
Update build.yml
HammerHam Dec 28, 2021
87f0395
Update build.yml
HammerHam Dec 28, 2021
ae72802
Update build.yml
HammerHam Dec 28, 2021
074f271
Update build.yml
HammerHam Dec 28, 2021
6eaabed
Create sonarcuberun1.yml
HammerHam Dec 28, 2021
e0fdaff
Update sonarcuberun1.yml
HammerHam Dec 28, 2021
b94e51c
Update sonarcuberun1.yml
HammerHam Dec 28, 2021
28ff93d
Create sonarcloud1.yml
HammerHam Dec 28, 2021
190b121
Update sonarcloud1.yml
HammerHam Dec 28, 2021
cf90f7d
Update pom.xml
HammerHam Jul 11, 2022
518ec71
Update Jenkinsfile
HammerHam Jul 11, 2022
78af38a
Update jenkinsfile
HammerHam Jul 13, 2022
2470d24
Update Jenkinsfile
HammerHam Jul 13, 2022
02dca8a
Update Jenkinsfile
HammerHam Jul 13, 2022
b8ec34d
Update Jenkinsfile
HammerHam Jul 13, 2022
d460764
Update Jenkinsfile
HammerHam Jul 13, 2022
4c97575
Update Jenkinsfile
HammerHam Jul 13, 2022
c083b42
Update Jenkinsfile
HammerHam Jul 13, 2022
51550d1
Update pom.xml
HammerHam Jul 14, 2022
1f24651
Update Jenkinsfile
HammerHam Jul 14, 2022
5718f00
Update Jenkinsfile
HammerHam Jul 14, 2022
04c1c7f
Update pom.xml
HammerHam Nov 7, 2022
17826b0
Update pom.xml
HammerHam Nov 22, 2022
d786854
Update Jenkinsfile
HammerHam Nov 22, 2022
f0a5a28
Update README with additional information
HammerHam Feb 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 18 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,21 @@
name: "Build"
on:
push:
branches: [ '*' ]
tags-ignore:
- '*'

name: GitHub Actions Demo
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
java: [11, 15]
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
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: Build with Maven
run: mvn clean install

notify-slack:
if: github.event_name == 'push' && (success() || failure())
needs:
- build
Explore-GitHub-Actions:
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}}
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v2
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."

branches:
- master # or the name of your main branch
Comment on lines +19 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Github actions branches filter misplaced 🐞 Bug ✓ Correctness

In .github/workflows/build.yml, the branches key is placed inside the job definition (same level
as runs-on and steps) instead of under the on: trigger block. GitHub Actions silently ignores
unknown job-level keys, so the workflow now triggers on every push to every branch with no
restriction.
Agent Prompt
## Issue description
The `branches` filter is placed inside the job definition instead of under the `on:` trigger. GitHub Actions ignores it there, causing the workflow to fire on every push to every branch.

## Issue Context
The correct structure requires `branches` to be nested under `on.push`, not at the job level. The original workflow (before this PR) had a proper multi-OS, multi-JDK matrix build that was replaced with a trivial demo.

## Fix Focus Areas
- .github/workflows/build.yml[1-21]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow integrates ShiftLeft NG SAST with GitHub
# Visit https://docs.shiftleft.io for help
name: ShiftLeft

on:
pull_request:
workflow_dispatch:
push:
# We recommend triggering a scan when merging to your default branch as a best practice,
# especially if you'd like to compare the results of two scans (e.g., a feature branch against the
# default branch)
branches:
- main
- master
jobs:
NextGen-Static-Analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download ShiftLeft CLI
run: |
curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl
Comment on lines +20 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Shiftleft cli downloaded without integrity check 🐞 Bug ⛨ Security

The ShiftLeft workflow downloads a binary from a CDN URL via curl and immediately marks it
executable and runs it — with no checksum or signature verification. A compromised CDN or MITM
attack would result in arbitrary code execution in the CI runner with access to
SHIFTLEFT_ACCESS_TOKEN and GITHUB_TOKEN.
Agent Prompt
## Issue description
The ShiftLeft CLI binary is downloaded and executed without any integrity verification. A tampered binary would execute with access to CI secrets.

## Issue Context
The binary is downloaded at line 22 and executed at line 29 with `SHIFTLEFT_ACCESS_TOKEN` and `GITHUB_TOKEN` in the environment. A checksum verification step must be added between download and execution.

## Fix Focus Areas
- .github/workflows/main.yml[20-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

# ShiftLeft requires Java 1.8. Post the package step override the version
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 1.8
- name: NextGen Static Analysis
run: ${GITHUB_WORKSPACE}/sl analyze --app ShiftLeftJS --tag branch=${{ github.head_ref }} --js --cpg $(pwd)
env:
SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
id: tag
uses: dawidd6/action-get-tag@v1

- name: Set up JDK 11
- name: Set up JDK 15
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 15
architecture: x64

- name: Cache Maven packages
Expand Down Expand Up @@ -111,10 +111,10 @@ jobs:
ref: develop
token: ${{ secrets.WEBGOAT_DEPLOYER_TOKEN }}

- name: Set up JDK 11
- name: Set up JDK 15
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 15
architecture: x64

- name: Set version to next snapshot
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/sonarcloud1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

name: SonarCloudHamid
jobs:
sonarqube:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
36 changes: 36 additions & 0 deletions .github/workflows/sonarcuberun1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: SonarPass12
on:
push:
branches:
- 891 # or the name of your main branch

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=WebGoat
24 changes: 24 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pipeline {
agent any

stages {
stage('Do Nothing') {
steps {
echo 'Doing Nothing..'
}
}
stage('Test Nothing') {
steps {
echo 'Testing Nothing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
sh '''#!/bin/bash
mvn deploy
'''
}
}
}
}
40 changes: 9 additions & 31 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,14 @@ Every release is also published on [DockerHub]((https://hub.docker.com/r/webgoat
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
docker run -p 127.0.0.1:8080:8080 -p 127.0.0.1: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

Expand All @@ -82,22 +56,23 @@ java -jar webgoat-server-8.1.0.jar [--server.port=8080] [--server.address=localh
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.
The latest version of WebGoat needs Java 15 or above. By default, WebGoat uses port 8080, the database uses 9000 and WebWolf use port 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.

Use `set` instead of export on Windows cmd.


## 3. Run from the sources

### Prerequisites:

* Java 11
* Java 15
* Maven > 3.2.1
* Your favorite IDE
* Git, or Git support in your IDE
Expand Down Expand Up @@ -134,13 +109,16 @@ server.address=x.x.x.x

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:
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
```
36 changes: 36 additions & 0 deletions build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build
on:
push:
branches:
- master # or the name of your main branch

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=WebGoat
12 changes: 0 additions & 12 deletions buildspec.yml

This file was deleted.

13 changes: 0 additions & 13 deletions docker-compose-local.yml

This file was deleted.

40 changes: 0 additions & 40 deletions docker-compose-postgres.yml

This file was deleted.

Loading
Loading