This document describes how you can contribute to WebGoat. Please read it carefully.
Table of Contents
- How to Contribute to the Project
- How to set up your Contributor Environment
- How to get your PR Accepted
There are a couple of ways on how you can contribute to the project:
- File 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). This is a direct contribution to the project and may be merged after review. You should ideally create an issue 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.
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:
- The code must be compliant with the configured Java Google Formatter, Checkstyle and PMD rules.
- All new and changed code should have a corresponding unit and/or integration test.
- New and changed lessons must have a corresponding integration test.
- Status checks should pass for your last commit.
Additionally, the following guidelines can help:
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.
-
Explain why you make the changes. More infos about a good commit message.
-
If you fix an issue with your commit, please close the issue by adding one of the keywords and the issue number to your commit message.
For example: Fix #545
or Closes #10
-
Create a GitHub account. Multiple different GitHub subscription plans are available, but you only need a free one. Follow these steps to set up your account.
-
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.
-
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.
-
Go to the newly cloned directory "WebGoat" and add the remote upstream repository:
$ git remote -v origin [email protected]:<your Github handle>/WebGoat.git (fetch) origin [email protected]:<your Github handle>/WebGoat.git (push) $ git remote add upstream [email protected]:WebGoat/WebGoat.git $ git remote -v origin [email protected]:<your Github handle>/WebGoat.git (fetch) origin [email protected]:<your Github handle>/WebGoat.git (push) upstream [email protected]:OWASP/WebGoat.git (fetch) upstream [email protected]:OWASP/WebGoat.git (push)
See also the GitHub documentation on "Configuring a remote for a fork".
-
Choose what to work on, based on any of the outstanding issues.
-
Create a branch so that you can cleanly work on the chosen issue:
git checkout -b FixingIssue66
-
Open your favorite editor and start making modifications. We recommend using the IntelliJ Idea.
-
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 bygit commit -m 'your commit message here'
to commit the modifications andgit push
to push your modifications to GitHub. -
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.
-
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.
-
When starting on a new PR in the future, make sure to always keep your local repo up to date:
$ 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".
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.
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 for all the details.