Skip to content

Commit ee08186

Browse files
authored
Merge pull request #188 from OWASP/feat/codeowners
feat: add commitlint and GH best practices
2 parents 941b5bc + 603213d commit ee08186

File tree

12 files changed

+309
-14
lines changed

12 files changed

+309
-14
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ updates:
1717
directory: "/wrongsecrets-balancer/ui" # Location of package manifests
1818
schedule:
1919
interval: "monthly"
20+
# check our npm for dev
21+
- package-ecosystem: "npm"
22+
directory: "/"
23+
schedule:
24+
interval: "monthly"
2025
- package-ecosystem: "npm" # See documentation for possible values
2126
directory: "/cleaner" # Location of package manifests
2227
schedule:

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Pre-commit check
33
# Controls when the workflow will run
44
on:
55
pull_request:
6-
branches: [master]
6+
branches: [main]
77
workflow_dispatch:
88

99
env:
1010
TF_DOCS_VERSION: v0.16.0
11-
TFSEC_VERSION: v1.27.6
12-
TFLINT_VERSION: v0.41.0
11+
TFLINT_VERSION: v0.44.1
12+
TF_VERSION: "1.3.4"
1313
permissions:
1414
contents: read
1515
jobs:
@@ -42,10 +42,5 @@ jobs:
4242
tar -zxvf terraform_docs.tar.gz terraform-docs
4343
chmod +x terraform-docs
4444
mv terraform-docs /usr/local/bin/
45-
- name: Setup tfsec
46-
run: |
47-
curl --output tfsec https://github.com/aquasecurity/tfsec/releases/download/${{env.TFSEC_VERSION}}/tfsec-linux-amd64
48-
chmod +x tfsec
49-
mv tfsec /usr/local/bin/
5045
- name: Pre-commit checks
5146
uses: pre-commit/[email protected]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ db.zip
1818
.letsencrypt
1919

2020
*.auto.tfvars
21+
node_modules
22+
.npm

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ repos:
44
rev: v4.3.0
55
hooks:
66
- id: check-yaml
7+
exclude: ^helm/wrongsecrets-ctf-party/templates/
78
- id: end-of-file-fixer
89
exclude: ^(src/test/resources/yourkey.txt|src/test/resources/secondkey.txt)
910
- id: trailing-whitespace
@@ -27,3 +28,8 @@ repos:
2728
- "--args=--only=terraform_standard_module_structure"
2829
- "--args=--only=terraform_workspace_remote"
2930
- id: terraform_docs
31+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
32+
rev: v9.4.0
33+
hooks:
34+
- id: commitlint
35+
stages: [commit-msg]

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These owners will be the default owners for everything in
2+
# the repo. Unless a later match takes precedence,
3+
* @commjoen @bendehaan

CONTRIBUTING.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Contributing
2+
3+
[![GitHub contributors](https://img.shields.io/github/contributors/OWASP/wrongsecrets-ctf-party.svg)](https://github.com/OWASP/wrongsecrets-ctf-party/graphs/contributors)
4+
![GitHub issues by-label "help wanted"](https://img.shields.io/github/issues/OWASP/wrongsecrets-ctf-party/help%20wanted.svg)
5+
6+
This document describes how you can contribute to WrongSecrets CTF Party. Please read it carefully.
7+
8+
**Table of Contents**
9+
10+
- [How to Contribute to the Project](#how-to-contribute-to-the-project)
11+
- [How to set up your Contributor Environment](#how-to-set-up-your-contributor-environment)
12+
- [How to get your PR Accepted](#how-to-get-your-pr-accepted)
13+
14+
## How to Contribute to the project
15+
16+
There are a couple of ways on how you can contribute to the project:
17+
18+
- **File [issues](https://github.com/OWASP/wrongsecrets-ctf-party/issues "WrongSecrets CTF Party Issues")** for missing content or errors. Explain what you think is missing and give a suggestion as to where it could be added.
19+
- **Create a [pull request (PR)](https://github.com/OWASP/wrongsecrets-ctf-party/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/OWASP/wrongsecrets-ctf-party/issues "WrongSecrets CTF Party 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.
20+
- **Promote us by giving us a Star or share information via social media**.
21+
22+
## How to get your PR accepted
23+
24+
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:
25+
The minimum requirements for code contributions are:
26+
27+
1. The code _must_ be compliant with the configured pre-commit hooks.
28+
2. All new and changed code _should_ have a corresponding unit and/or integration test.
29+
3. New and changed lessons _must_ have a corresponding integration test.
30+
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.
31+
32+
Additionally, the following guidelines can help:
33+
34+
### Keep your pull requests limited to a single issue
35+
36+
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:
37+
38+
- If you are making spelling corrections in the docs, don't modify other files.
39+
- If you are adding new functions don't '_cleanup_' unrelated functions. That cleanup belongs in another pull request.
40+
41+
### Write a good commit message
42+
43+
- Make sure your commit message passes the [conventional commit standards](https://www.conventionalcommits.org/en/v1.0.0/)
44+
- Explain why you make the changes. [More info about a good commit message.](https://betterprogramming.pub/stop-writing-bad-commit-messages-8df79517177d)
45+
- 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.
46+
47+
For example: `Fix #545` or `Closes #10`
48+
49+
## How to set up your Contributor Environment
50+
51+
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.
52+
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").
53+
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.
54+
4. Go to the newly cloned directory "wrongsecrets" and add the remote upstream repository:
55+
56+
```bash
57+
$ git remote -v
58+
origin [email protected]:<your Github handle>/wrongsecrets-ctf-party.git (fetch)
59+
origin [email protected]:<your Github handle>/wrongsecrets-ctf-party.git (push)
60+
61+
$ git remote add upstream [email protected]:OWASP/wrongsecrets-ctf-party.git
62+
63+
$ git remote -v
64+
origin [email protected]:<your Github handle>/wrongsecrets-ctf-party.git (fetch)
65+
origin [email protected]:<your Github handle>/wrongsecrets-ctf-party.git (push)
66+
upstream [email protected]:OWASP/wrongsecrets-ctf-party.git (fetch)
67+
upstream [email protected]:OWASP/wrongsecrets-ctf-party.git (push)
68+
```
69+
70+
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")".
71+
72+
5. Choose what to work on, based on any of the outstanding [issues](https://github.com/OWASP/wrongsecrets-ctf-party/issues "WrongSecrets CTF Party Issues").
73+
6. Create a branch so that you can cleanly work on the chosen issue: `git checkout -b fix/Issue66`
74+
7. Open your favorite editor and start making modifications. We recommend using the [IntelliJ Idea](https://www.jetbrains.com/idea/).
75+
8. Install [pre-commit](https://pre-commit.com/#install) the dependencies for our pre-commit configuration to make sure your code complies with standards used in the project. This requires terraform, [terraform-docs](https://github.com/terraform-docs/terraform-docs#installation), [tflint](https://github.com/terraform-linters/tflint#installation), and [commitlint](https://commitlint.js.org/#/guides-local-setup). For commitlint, you need [NodeJS](https://nodejs.org/en/download/) installed, after which you you can use `npm install` in the root folder of this project.
76+
9. Install the pre-commit hook using `pre-commit install --hook-type commit-msg`. We recommend to run `pre-commit run -a` every so often if you're working on a bigger change.
77+
10. 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.
78+
11. Create a Pull Request (PR) by going to your fork, <https://github.com/Your_Github_Handle/wrongsecrets> and click on the "New Pull Request" button. The target branch should typically be the main 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.
79+
12. If something in your git workflow went wrong (and e.g., the precommit hook CI run failed), check out ["O Shit, Git!?!"](https://ohshitgit.com/) to view tips on editing your historical commit message(s), among others.
80+
13. 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.
81+
14. When starting on a new PR in the future, make sure to always keep your local repo up to date:
82+
83+
```bash
84+
git fetch upstream
85+
git merge upstream/develop
86+
```
87+
88+
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")".
89+
90+
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.
91+
92+
> 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.
93+
94+
## What not to do
95+
96+
Although we greatly appreciate any and all contributions to the project, there are a few things that you should take into consideration:
97+
98+
- The Wrongsecrets 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.
99+
- 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.
100+
101+
Please be sure to take a careful look at our [Code of Conduct](https://github.com/OWASP/wrongsecrets-ctf-party/blob/main/CODE_OF_CONDUCT.md) for all the details.

PULL_REQUEST_TEMPLATE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Thank you for submitting a pull request to the WrongSecrets Party!
2+
3+
What kind of changes does this PR include?
4+
5+
- [ ] Fixes or refactors
6+
- [ ] Platform support
7+
- [ ] A new feature
8+
- [ ] Additional documentation
9+
- [ ] Something else
10+
11+
Checklist:
12+
13+
- [ ] All the contributions made are solely the work of me and my co-authors
14+
- [ ] I tested the changes in this PR (if applicable)
15+
- [ ] I added tests to ensure my change works (if applicable)
16+
- [ ] The PR passes pre-commit hooks and automated tests

aws/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,19 @@ The documentation below is auto-generated to give insight on what's created via
135135

136136
| Name | Version |
137137
|------|---------|
138-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.48.0 |
139-
| <a name="provider_http"></a> [http](#provider\_http) | 3.2.1 |
140-
| <a name="provider_random"></a> [random](#provider\_random) | 3.4.3 |
138+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.1 |
139+
| <a name="provider_http"></a> [http](#provider\_http) | ~> 3.1 |
140+
| <a name="provider_random"></a> [random](#provider\_random) | ~> 3.0 |
141141

142142
## Modules
143143

144144
| Name | Source | Version |
145145
|------|--------|---------|
146146
| <a name="module_cluster_autoscaler_irsa_role"></a> [cluster\_autoscaler\_irsa\_role](#module\_cluster\_autoscaler\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.9.0 |
147147
| <a name="module_ebs_csi_irsa_role"></a> [ebs\_csi\_irsa\_role](#module\_ebs\_csi\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.9.0 |
148-
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 19.4.2 |
148+
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 19.7.0 |
149149
| <a name="module_load_balancer_controller_irsa_role"></a> [load\_balancer\_controller\_irsa\_role](#module\_load\_balancer\_controller\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.9.0 |
150-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.18.1 |
150+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.19.0 |
151151

152152
## Resources
153153

aws/shared-state/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The documentation below is auto-generated to give insight on what's created via
1313

1414
| Name | Version |
1515
|------|---------|
16-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.48.0 |
16+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.0 |
1717

1818
## Modules
1919

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// commitlint.config.js
2+
module.exports = {
3+
extends: [
4+
"@commitlint/config-conventional", // scoped packages are not prefixed
5+
],
6+
};

0 commit comments

Comments
 (0)