Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: DOS protection of non-relay req/resp protocols new cli argument description #216

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

NagyZoltanPeter
Copy link
Contributor

This is part of waku-org/nwaku#3035 and waku-org/nwaku#3028.
PM: waku-org/pm#66 deliverable.

This PR adds description of --rate-limit cli option and exact usage.

Copy link

vercel bot commented Sep 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-waku-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 0:02am

Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Generally looks good. Minor comment below.


| Name | Default Value | Description |
| ---------------------------- | ------------- | ------------------------------------------------------ |
| <nobr>`rate-limit`</nobr> | | This is a repeatable option. Each one of them can describe spefic rate limit configuration for a particular protocol.<br>\<protocol\>:volume/period\<time-unit\><br>- if protocol is not given, settings will be taken as default for un-set protocols. Ex: `80/2s`<br>-Supported protocols are: `lightpush`\|`filter`\|`px`\|`store`\|`storev2`\|`storev3`<br>-volume must be an integer value, representing number of requests over the period of time allowed.<br>-period\<time-unit\> must be an integer with defined unit as one of `h`\|`m`\|`s`\|`ms`<br>- `storev2` and `storev3` takes precedence over `store` which can easy set both store protocols at once.<br>- In case of multiple set of the same protocol limit, last one will take place.<br>- if config is not set it means unlimited requests are allowed.<br>-filter has a bit different approach. It has a default setting applied if not overridden. Rate limit setting for filter will be applied per subscriber-peers, not globally - it must be considered when changing the setting.<br><br>Examples:<br>- `100/1s` - default for all protocols if not set otherwise.<br>-`lightpush:0/0s` - lightpush protocol will be not rate limited.<br>-`store:130/1500ms` - both store-v3 and store-v2 will apply 130 request per each 1500ms separately.<br>-`px:10/1h` PeerExchange will serve only 10 requests in every hour.<br>-`filter:8/5m` - will allow 8 subs/unsubs/ping requests for each subscribers within every 5 min. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need the storev2 and storev3 differentiation? I would hide this complexity, especially since we plan to deprecate storev2 completely, soon. I would simply allow a single configuration option here for store that sets the rate limit for both protocols.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Currently for status we are using both protocol and they have very different loads so it is inconvenient to describe them similar rate limits. It was the original idea behind the distinction.
Would it be ok, to remove it whit the removal of legacy store protocol?

Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@NagyZoltanPeter NagyZoltanPeter merged commit edb6b63 into develop Sep 23, 2024
3 checks passed
@NagyZoltanPeter NagyZoltanPeter deleted the chore-add-rate-limit-cli-description branch September 23, 2024 12:07

| Name | Default Value | Description |
| ---------------------------- | ------------- | ------------------------------------------------------ |
| `rate-limit` | | This is a repeatable option. Each one of them can describe spefic rate limit configuration for a particular protocol.<br />\<protocol\>:volume/period\<time-unit\><br />- if protocol is not given, settings will be taken as default for un-set protocols. Ex: `80/2s`<br />-Supported protocols are: `lightpush`\|`filter`\|`px`\|`store`\|`storev2`\|`storev3`<br />-volume must be an integer value, representing number of requests over the period of time allowed.<br />-period\<time-unit\> must be an integer with defined unit as one of `h`\|`m`\|`s`\|`ms`<br />- `storev2` and `storev3` takes precedence over `store` which can easy set both store protocols at once.<br />- In case of multiple set of the same protocol limit, last one will take place.<br />- if config is not set it means unlimited requests are allowed.<br />-filter has a bit different approach. It has a default setting applied if not overridden. Rate limit setting for filter will be applied per subscriber-peers, not globally - it must be considered when changing the setting.<br /><br />Examples:<br />- `100/1s` - default for all protocols if not set otherwise.<br />-`lightpush:0/0s` - lightpush protocol will be not rate limited.<br />-`store:130/1500ms` - both store-v3 and store-v2 will apply 130 request per each 1500ms separately.<br />-`px:10/1h` PeerExchange will serve only 10 requests in every hour.<br />-`filter:8/5m` - will allow 8 subs/unsubs/ping requests for each subscribers within every 5 min. |
Copy link
Contributor

Choose a reason for hiding this comment

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

spefic

specific


<protocol>:volume/period<time-unit>

I'd wrap that in backticks "`"

Copy link
Contributor

Choose a reason for hiding this comment

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

what's the default value?

fryorcraken pushed a commit to 666devs/docs.waku.org that referenced this pull request Oct 1, 2024
…t description (waku-org#216)

* DOS protection of non-relay req/resp protocols has a new cli argument, now described officially.
danisharora099 pushed a commit that referenced this pull request Oct 1, 2024
…t description (#216)

* DOS protection of non-relay req/resp protocols has a new cli argument, now described officially.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants