Skip to content

Commit

Permalink
Add a pre-commit-config file and passed all checks
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Sep 29, 2023
1 parent f3fc691 commit 1f90d36
Show file tree
Hide file tree
Showing 182 changed files with 325 additions and 306 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.vscode/
__pycache__
env
node_modules
node_modules
4 changes: 2 additions & 2 deletions .github/workflows/dev-update-mmdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cd src/bw/misc/
CURL_RETURN_CODE=0
CURL_OUTPUT=`curl -w httpcode=%{http_code} -s -o asn.mmdb.gz https://download.db-ip.com/free/dbip-asn-lite-$(date +%Y-%m).mmdb.gz 2> /dev/null` || CURL_RETURN_CODE=$?
if [ ${CURL_RETURN_CODE} -ne 0 ]; then
if [ ${CURL_RETURN_CODE} -ne 0 ]; then
echo "Curl connection failed when downloading asn-lite mmdb file with return code - ${CURL_RETURN_CODE}"
exit 1
else
Expand All @@ -37,7 +37,7 @@ jobs:
fi
CURL_RETURN_CODE=0
CURL_OUTPUT=`curl -w httpcode=%{http_code} -s -o country.mmdb.gz https://download.db-ip.com/free/dbip-country-lite-$(date +%Y-%m).mmdb.gz 2> /dev/null` || CURL_RETURN_CODE=$?
if [ ${CURL_RETURN_CODE} -ne 0 ]; then
if [ ${CURL_RETURN_CODE} -ne 0 ]; then
echo "Curl connection failed when downloading country-lite mmdb file with return code - ${CURL_RETURN_CODE}"
exit 1
else
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ jobs:
body: |
Documentation : https://docs.bunkerweb.io/${{ inputs.VERSION }}/
Docker tags :
Docker tags :
- BunkerWeb : `bunkerity/bunkerweb:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb:${{ inputs.VERSION }}`
- Scheduler : `bunkerity/bunkerweb-scheduler:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb-scheduler:${{ inputs.VERSION }}`
- Autoconf : `bunkerity/bunkerweb-autoconf:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb-autoconf:${{ inputs.VERSION }}`
- UI : `bunkerity/bunkerweb-ui:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb-ui:${{ inputs.VERSION }}`
Linux packages : https://packagecloud.io/app/bunkerity/bunkerweb/search?q=${{ inputs.VERSION }}&filter=all&dist=
Changelog :
Changelog :
${{ steps.getchangelog.outputs.content }}
draft: true
prerelease: ${{ inputs.PRERELEASE }}
Expand All @@ -82,7 +82,7 @@ jobs:
Documentation : https://docs.bunkerweb.io/${{ inputs.VERSION }}/
Docker tags :
Docker tags :
- BunkerWeb : `bunkerity/bunkerweb:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb:${{ inputs.VERSION }}`
- Scheduler : `bunkerity/bunkerweb-scheduler:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb-scheduler:${{ inputs.VERSION }}`
- Autoconf : `bunkerity/bunkerweb-autoconf:${{ inputs.VERSION }}` or `ghcr.io/bunkerity/bunkerweb-autoconf:${{ inputs.VERSION }}`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
if: inputs.TYPE == 'k8s'
- run: |
echo "$SECRET_KEY" > /tmp/.secret_key
openssl enc -d -in /tmp/terraform.tar.enc -aes-256-cbc -pbkdf2 -iter 100000 -md sha256 -pass file:/tmp/.secret_key -out /tmp/terraform.tar
openssl enc -d -in /tmp/terraform.tar.enc -aes-256-cbc -pbkdf2 -iter 100000 -md sha256 -pass file:/tmp/.secret_key -out /tmp/terraform.tar
rm -f /tmp/.secret_key
tar xf /tmp/terraform.tar -C /
mkdir /tmp/reg
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: (^LICENSE.md$|^src/VERSION$|^src/(deps/src/|common/core/modsecurity/files/coreruleset/|ui/static/js/(editor/|utils/purify/|tsparticles\.bundle\.min\.js))|\.(svg|drawio|patch\d?|ascii|pem|tf|tftpl)$)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-case-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/ambv/black
rev: 23.9.1
hooks:
- id: black
language_version: python3.9
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v1.5.3 -
## v1.5.3 -

- [BUGFIX] Fix BunkerWeb not loading his own settings after a docker restart
- [BUGFIX] Fix Custom configs not following the service name after an update on the UI
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
https://www.contributor-covenant.org/translations.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

<p align="center">
📓 <a href="https://docs.bunkerweb.io">Documentation</a>
&#124;
&#124;
👨‍💻 <a href="https://demo.bunkerweb.io">Demo</a>
&#124;
&#124;
🛡️ <a href="./examples">Examples</a>
&#124;
&#124;
💬 <a href="https://discord.com/invite/fTf46FmtyD">Chat</a>
&#124;
&#124;
📝 <a href="https://github.com/bunkerity/bunkerweb/discussions">Forum</a>
&#124;
⚙️ <a href="https://config.bunkerweb.io">Configurator</a>
Expand Down Expand Up @@ -142,7 +142,7 @@ Another core component of BunkerWeb is the ModSecurity Web Application Firewall
State of the current configuration of BunkerWeb is stored in a backend database which contains the following data :

- Settings defined for all the services
- Custom configurations
- Custom configurations
- BunkerWeb instances
- Metadata about jobs execution
- Cached files
Expand Down Expand Up @@ -355,3 +355,8 @@ If you would like to contribute to the plugins you can read the [contributing gu
# Security policy

We take security bugs as serious issues and encourage responsible disclosure, see our [security policy](./SECURITY.md) for more information.


# Stargazers over time

[![Stargazers over time](https://starchart.cc/bunkerity/bunkerweb.svg)](https://starchart.cc/bunkerity/bunkerweb)
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Here is a non-exhaustive list of issues we consider as high risk :

## Bounty

To encourage responsible disclosure, we may reward you with a bounty at the sole discretion of the maintainers.
To encourage responsible disclosure, we may reward you with a bounty at the sole discretion of the maintainers.
2 changes: 1 addition & 1 deletion docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ In essence, the scheduler serves as the brain of BunkerWeb, orchestrating variou

Depending on the integration approach, the execution environment of the scheduler may differ. In container-based integrations, the scheduler is executed within its dedicated container, providing isolation and flexibility. On the other hand, for Linux-based integrations, the scheduler is self-contained within the bunkerweb service, simplifying the deployment and management process.

By employing the scheduler, BunkerWeb streamlines the automation and coordination of essential tasks, enabling efficient and reliable operation of the entire system.
By employing the scheduler, BunkerWeb streamlines the automation and coordination of essential tasks, enabling efficient and reliable operation of the entire system.
20 changes: 10 additions & 10 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ volumes:
```

For example, if you have a value of **100000**, the mapped UID/GID will be **100100** (100000 + 100) :

```shell
mkdir bw-data && \
sudo chgrp 100100 bw-data && \
chmod 770 bw-data
```

Or if the folder already exists :

```shell
sudo chgrp -R 100100 bw-data && \
chmod -R 770 bw-data
Expand Down Expand Up @@ -188,7 +188,7 @@ By default, BunkerWeb container is listening (inside the container) on **8080/tc

!!! warning "Privileged ports in rootless mode or when using podman"
If you are using [Docker in rootless mode](https://docs.docker.com/engine/security/rootless) and want to redirect privileged ports (< 1024) like 80 and 443 to BunkerWeb, please refer to the prerequisites [here](https://docs.docker.com/engine/security/rootless/#exposing-privileged-ports).

If you are using [podman](https://podman.io/) you can lower the minimum number for unprivileged ports :
```shell
sudo sysctl net.ipv4.ip_unprivileged_port_start=1
Expand Down Expand Up @@ -465,7 +465,7 @@ As for the database volume, the documentation does not specify a specific approa

!!! info "Database backend"
Please be aware that our instructions assume you are using MariaDB as the default database backend, as configured by the `DATABASE_URI` setting. However, we understand that you may prefer to utilize alternative backends for your Docker integration. If that is the case, rest assured that other database backends are still possible. See docker-compose files in the [misc/integrations folder](https://github.com/bunkerity/bunkerweb/tree/v1.5.2/misc/integrations) folder of the repository for more information.

Clustered database backends setup are out-of-the-scope of this documentation.

Here is the stack boilerplate that you can deploy using `docker stack deploy` :
Expand Down Expand Up @@ -638,7 +638,7 @@ Given the presence of multiple BunkerWeb instances, it is necessary to establish

!!! info "Database backend"
Please be aware that our instructions assume you are using MariaDB as the default database backend, as configured by the `DATABASE_URI` setting. However, we understand that you may prefer to utilize alternative backends for your Docker integration. If that is the case, rest assured that other database backends are still possible. See docker-compose files in the [misc/integrations folder](https://github.com/bunkerity/bunkerweb/tree/v1.5.2/misc/integrations) folder of the repository for more information.

Clustered database backends setup are out-of-the-scope of this documentation.

Please ensure that both the scheduler and autoconf services have access to the Kubernetes API. It is recommended to utilize [RBAC authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) for this purpose.
Expand Down Expand Up @@ -985,7 +985,7 @@ To simplify the installation process, Linux package repositories for BunkerWeb a
sudo apt update && \
sudo apt install -y bunkerweb=1.5.2
```

To prevent upgrading NGINX and/or BunkerWeb packages when executing `apt upgrade`, you can use the following command :

```shell
Expand Down Expand Up @@ -1022,7 +1022,7 @@ To simplify the installation process, Linux package repositories for BunkerWeb a
sudo apt update && \
sudo apt install -y bunkerweb=1.5.2
```

To prevent upgrading NGINX and/or BunkerWeb packages when executing `apt upgrade`, you can use the following command :

```shell
Expand Down Expand Up @@ -1188,7 +1188,7 @@ the configuration of BunkerWeb is done by using specific role variables :

List of supported providers :

- virtualbox
- virtualbox
- libvirt

!!! note "Supported Base Images"
Expand Down Expand Up @@ -1253,4 +1253,4 @@ Vagrant.configure("2") do |config|
# For libvirt
# config.vm.provider "libvirt"
end
```
```
2 changes: 1 addition & 1 deletion docs/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ See the list of [redis settings](settings.md#redis) and the corresponding docume

## Default values and new settings

The default value of some settings have changed and we have added many other settings, we recommend you read the [security tuning](security-tuning.md) and [settings](settings.md) sections of the documentation.
The default value of some settings have changed and we have added many other settings, we recommend you read the [security tuning](security-tuning.md) and [settings](settings.md) sections of the documentation.
4 changes: 2 additions & 2 deletions docs/misc/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ console.log('Saving', url, 'to', pdfPath);
// totalPages – total pages in the document
headerHtml = `
<div style="font-size: 10px; text-align: center; width: 100%;">
<span>${title}</span>
<span>${title}</span>
</div>`;

footerHtml = `<div style="font-size: 10px; text-align: center; width: 100%;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>`;
Expand Down Expand Up @@ -46,4 +46,4 @@ footerHtml = `<div style="font-size: 10px; text-align: center; width: 100%;"><sp
});

await browser.close();
})();
})();
2 changes: 1 addition & 1 deletion docs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
data-domain="docs.bunkerweb.io"
src="https://data.bunkerity.com/js/script.js"
></script>
{% endblock %}
{% endblock %}
4 changes: 2 additions & 2 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ The first step is to install the plugin by putting the plugin files inside the c
=== "Ansible"

When using the [Ansible integration](integrations.md#ansible), you can use the `plugins` variable to set a local folder containing your plugins that will be copied to your BunkerWeb instances.

Let's assume that you have plugins inside the `bunkerweb-plugins` folder :

```shell
Expand All @@ -231,7 +231,7 @@ The first step is to install the plugin by putting the plugin files inside the c
[mybunkers]
192.168.0.42 ... custom_plugins="{{ playbook_dir }}/bunkerweb-plugins"
```

Or alternatively, in your playbook file :

```yaml
Expand Down
Loading

0 comments on commit 1f90d36

Please sign in to comment.