diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a57b95..fad8cb8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,10 +4,10 @@ on: workflow_call: secrets: dockerhub-push-token: - description: Authentication token to push images to Docker Hub + description: Authentication token to push images to Docker Hub. required: true ghcr-push-token: - description: Authentication token to push images to the Github Container Registry + description: Authentication token to push images to the Github Container Registry. required: true jobs: @@ -44,7 +44,7 @@ jobs: with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.dockerhub-push-token }} - - name: Login to GitHub Container Registry + - name: Login to Github Container Registry uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 with: registry: ghcr.io diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml index 0ee6ac1..96b8afc 100644 --- a/.github/workflows/mdbook.yml +++ b/.github/workflows/mdbook.yml @@ -17,7 +17,7 @@ jobs: name: Build book runs-on: ubuntu-latest env: - MDBOOK_VERSION: 0.4.45 + MDBOOK_VERSION: 0.4.51 MDBOOK_MERMAID_VERSION: 0.15.0 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..364b8a5 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,7 @@ +# Code of Conduct + +This project adheres to the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct). This describes the minimum behavior expected from all contributors. + +## Enforcement + +Instances of violations of the Code of Conduct can be reported by contacting the project team at [coc@sandhole.com.br](mailto:coc@sandhole.com.br). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4826481 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# Contributing + +Hello, and thank you for taking the time to read the contributing guidelines for Sandhole! Please read through our [Code of Conduct](./CODE_OF_CONDUCT.md) as well. + +Here are some ways to contribute to the project: + +## Creating issues + +Please search the [existing issues](https://github.com/EpicEric/sandhole/issues), as well as [the Sandhole book](https://sandhole.com.br/), for any answers or existing discussions before creating your own issue. + +## Submitting changes + +In the case that you'd like to make contributions to Sandhole, create an issue first if one does not exist. + +If you wish to contribute changes to Sandhole, please [fork the repository](https://github.com/EpicEric/sandhole/fork), push your modifications to a branch, and create a [pull request](https://github.com/EpicEric/sandhole/compare). Make sure to [link to the original issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) in your PR's body. + +Make sure that your changes pass all tests/linting/formatting checks before creating a pull request by running `just test` and `just clippy`. This will speed up reviews. + +Please add a short description of any user-facing changes to the top of [CHANGELOG.md](./CHANGELOG.md), under the "Unreleased" section (or create one if it does not exist). The changelog should adhere to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and it must emphasize any breaking changes. + +If you're adding or modifying a command line option to Sandhole, run `just cli`, manually format the contents output to `cli.html` (i.e. by wrapping long lines and removing trailing whitespace), and update the [cli.md page](./book/src/cli.md) accordingly. diff --git a/README.md b/README.md index ff1074c..e753070 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Sandhole -[![GitHub Actions workflow status](https://img.shields.io/github/actions/workflow/status/EpicEric/sandhole/validate.yml?label=tests)](https://github.com/EpicEric/sandhole/actions/workflows/validate.yml) -[![Codecov](https://img.shields.io/codecov/c/github/EpicEric/sandhole)](https://app.codecov.io/github/EpicEric/sandhole) -[![crates.io version](https://img.shields.io/crates/v/sandhole)](https://crates.io/crates/sandhole) -[![GitHub license](https://img.shields.io/github/license/EpicEric/sandhole)](https://github.com/EpicEric/sandhole/blob/main/LICENSE) +[![Github Actions workflow status](https://img.shields.io/github/actions/workflow/status/EpicEric/sandhole/validate.yml?label=tests&logo=githubactions)](https://github.com/EpicEric/sandhole/actions/workflows/validate.yml) +[![Codecov](https://img.shields.io/codecov/c/github/EpicEric/sandhole?token=YNJUQDQ38S&logo=codecov)](https://app.codecov.io/github/EpicEric/sandhole) +[![crates.io version](https://img.shields.io/crates/v/sandhole?logo=rust)](https://crates.io/crates/sandhole) +[![Github license](https://img.shields.io/github/license/EpicEric/sandhole?logo=github)](https://github.com/EpicEric/sandhole/blob/main/LICENSE) ![The Sandhole logo, with a crab partially inside a sand mound and the name "Sandhole" written in cursive beside them.](https://sandhole.com.br/logo.png) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..be297a2 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +## Reporting a Vulnerability + +Please report vunerabilities using Github's Private Vulnerability Reporting tool, or by sending an e-mail to [security@sandhole.com.br](mailto:security@sandhole.com.br). + +Do not use public Github Issues for reporting vulnerabilities. diff --git a/justfile b/justfile index 7de0c70..5091880 100644 --- a/justfile +++ b/justfile @@ -4,8 +4,11 @@ default: test $RUST_LOG="sandhole=debug": cargo test -install-dev-deps: - cargo install mdbook mdbook-mermaid to-html flamegraph +clippy: + cargo clippy --all-targets --fix --allow-dirty --allow-staged && cargo fmt --all + +clippy-nightly: + cargo +nightly clippy --all-targets --fix --allow-dirty --allow-staged && cargo fmt --all book: mdbook serve book --open @@ -16,8 +19,10 @@ cli: flamegraph-test test: cargo flamegraph --dev --test {{test}} -clippy: - cargo clippy --all-targets --fix --allow-dirty --allow-staged && cargo fmt --all +install-dev-deps: install-book-deps install-profiling-deps -clippy-nightly: - cargo +nightly clippy --all-targets --fix --allow-dirty --allow-staged && cargo fmt --all +install-book-deps: + cargo install mdbook mdbook-mermaid to-html + +install-profiling-deps: + cargo install flamegraph diff --git a/tests/alias_rate_limit_download.rs b/tests/alias_rate_limit_download.rs index 5c15d92..c72372a 100644 --- a/tests/alias_rate_limit_download.rs +++ b/tests/alias_rate_limit_download.rs @@ -141,13 +141,11 @@ async fn alias_rate_limit_download() { assert_eq!(buf, &[42][..]); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/alias_rate_limit_upload.rs b/tests/alias_rate_limit_upload.rs index 85b8c2d..2823b90 100644 --- a/tests/alias_rate_limit_upload.rs +++ b/tests/alias_rate_limit_upload.rs @@ -134,13 +134,11 @@ async fn alias_rate_limit_upload() { let elapsed = start.elapsed(); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/https_rate_limit_download.rs b/tests/https_rate_limit_download.rs index 3e5b008..e8e7fa9 100644 --- a/tests/https_rate_limit_download.rs +++ b/tests/https_rate_limit_download.rs @@ -159,13 +159,11 @@ async fn https_rate_limit_download() { assert_eq!(response.status(), StatusCode::NO_CONTENT); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/https_rate_limit_upload.rs b/tests/https_rate_limit_upload.rs index 539e0b0..e963e17 100644 --- a/tests/https_rate_limit_upload.rs +++ b/tests/https_rate_limit_upload.rs @@ -156,13 +156,11 @@ async fn https_rate_limit_upload() { assert!(body.len() == 50_000); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/ssh_rate_limit_download.rs b/tests/ssh_rate_limit_download.rs index 7e86fa3..128bad0 100644 --- a/tests/ssh_rate_limit_download.rs +++ b/tests/ssh_rate_limit_download.rs @@ -158,13 +158,11 @@ async fn ssh_rate_limit_download() { let elapsed = start.elapsed(); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/ssh_rate_limit_upload.rs b/tests/ssh_rate_limit_upload.rs index f48a24f..10bf84d 100644 --- a/tests/ssh_rate_limit_upload.rs +++ b/tests/ssh_rate_limit_upload.rs @@ -155,13 +155,11 @@ async fn ssh_rate_limit_upload() { let elapsed = start.elapsed(); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/tcp_rate_limit_download.rs b/tests/tcp_rate_limit_download.rs index 873c189..3db0d89 100644 --- a/tests/tcp_rate_limit_download.rs +++ b/tests/tcp_rate_limit_download.rs @@ -107,13 +107,11 @@ async fn tcp_rate_limit_download() { assert_eq!(buf, &[42][..]); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); } diff --git a/tests/tcp_rate_limit_upload.rs b/tests/tcp_rate_limit_upload.rs index 79b97e9..7ab0162 100644 --- a/tests/tcp_rate_limit_upload.rs +++ b/tests/tcp_rate_limit_upload.rs @@ -102,13 +102,11 @@ async fn tcp_rate_limit_upload() { let elapsed = start.elapsed(); assert!( elapsed > Duration::from_secs(2), - "must've taken more than 2 seconds, but was {:?}", - elapsed + "must've taken more than 2 seconds, but was {elapsed:?}" ); assert!( elapsed < Duration::from_secs(3), - "must've taken less than 3 seconds, but was {:?}", - elapsed + "must've taken less than 3 seconds, but was {elapsed:?}" ); }