Compare commits
4 Commits
@nhost/apo
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdaaf19057 | ||
|
|
a7cd02c965 | ||
|
|
3d70c63d1b | ||
|
|
ba55c1b779 |
@@ -1,5 +1,11 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 1.27.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- a7cd02c: fix: resolve rate limit query
|
||||
|
||||
## 1.26.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "1.26.0",
|
||||
"version": "1.27.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
|
||||
@@ -248,8 +248,6 @@ export default function AuthLimitingForm() {
|
||||
>
|
||||
<SettingsContainer
|
||||
title="Auth"
|
||||
switchId="enabled"
|
||||
showSwitch
|
||||
slotProps={{
|
||||
submitButton: {
|
||||
disabled: !formState.isDirty || maintenanceActive,
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function useGetRateLimits() {
|
||||
const { data, loading } = useGetRateLimitConfigQuery({
|
||||
variables: {
|
||||
appId: currentProject?.id,
|
||||
resolve: false,
|
||||
resolve: true,
|
||||
},
|
||||
skip: !currentProject,
|
||||
...(!isPlatform ? { client: localMimirClient } : {}),
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost/docs
|
||||
|
||||
## 2.16.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- ba55c1b: feat: run: added a guide on using a private registry
|
||||
- 3d70c63: feat: added rate-limiter guide for auth service
|
||||
|
||||
## 2.15.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -93,3 +93,56 @@ Wait a few seconds until the project is done updating the new service and visit
|
||||
|
||||

|
||||
|
||||
## Using your own private registry
|
||||
|
||||
If you are publishing your images in your own private registry you can add pull credentials to your Run configuration so the image can be pulled successfully. To do so follow the next steps:
|
||||
|
||||
1. Figure out the credentials you need. This might depend on your registry. For instructions on various registries see the next section.
|
||||
2. The credentials will be similar to:
|
||||
|
||||
```json
|
||||
{
|
||||
"auths": {
|
||||
"https://myregistry.com/v1": {
|
||||
"username": "myuser",
|
||||
"password": "mypassword"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Create a secret under Settings -> Secrets with the contents of the auth section. For instance:
|
||||
|
||||

|
||||
|
||||
Pay attention that **only** the object inside "auths" is to be added.
|
||||
|
||||
4. Configure the `pullCredentials` in your run configuration.
|
||||
|
||||
```toml
|
||||
[image]
|
||||
image = 'myprivaterepo/myservice:1.0.1'
|
||||
pullCredentials = '{{ secrets.CONTAINER_REGISTRY_CREDENTIALS }}'
|
||||
```
|
||||
|
||||
Pulling your image should work now.
|
||||
|
||||
### Docker Hub Credentials
|
||||
|
||||
To create a credential that allows you to pull private images from Docker hub follow the next steps:
|
||||
|
||||
1. Login to https://hub.docker.com with a user that can pull the image you want.
|
||||
2. Head to "Account Settings" -> "Personal access tokens"
|
||||
3. Create a new token with "Read Only" access permissions
|
||||
4. Copy the token you got
|
||||
|
||||
Your credentials will be:
|
||||
|
||||
```json
|
||||
{
|
||||
"https://index.docker.io/v1/": {
|
||||
"username":"<yourusername>",
|
||||
"password":"<the_token_you_just_got>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
BIN
docs/images/guides/run/registry_8.png
Normal file
BIN
docs/images/guides/run/registry_8.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 429 KiB |
BIN
docs/images/platform/rate-limiting/auth.png
Normal file
BIN
docs/images/platform/rate-limiting/auth.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 365 KiB |
BIN
docs/images/platform/rate-limiting/misc.png
Normal file
BIN
docs/images/platform/rate-limiting/misc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 354 KiB |
@@ -84,7 +84,8 @@
|
||||
"platform/environment-variables",
|
||||
"platform/secrets",
|
||||
"platform/deployments",
|
||||
"platform/custom-domains"
|
||||
"platform/custom-domains",
|
||||
"platform/rate-limits"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/docs",
|
||||
"version": "2.15.0",
|
||||
"version": "2.16.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "mintlify dev"
|
||||
|
||||
112
docs/platform/rate-limits.mdx
Normal file
112
docs/platform/rate-limits.mdx
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: Rate Limits
|
||||
sidebarTitle: Rate Limits
|
||||
description: Protecting your service against abuse
|
||||
icon: shield
|
||||
---
|
||||
|
||||
Rate limits in an HTTP API are essential for protecting services against abuse and brute force attacks by restricting the number of requests a client can make within a specified time period. By enforcing rate limits, we can mitigate the risk of unauthorized access, denial of service attacks, and excessive consumption of resources.
|
||||
|
||||
Limits work by setting a maximum number of requests (burst amount) allowed for a key within a specified time frame (recovery time). For example, with a limit of 30 requests and a recovery time of 5 minutes, a user can make up to 30 requests before hitting the limit. Additionally, the user receives an extra request every 10 seconds (5 * 60 / 30) until reaching the limit.
|
||||
|
||||
## GraphQL/Storage/Functions
|
||||
|
||||
You can rate-limit the GraphQL, Storage, and Functions services independently of each other. These rate limits are based on the client IP, and requests made to one service do not count toward the rate limits of another service.
|
||||
|
||||
### Configuration
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Dashboard">
|
||||
**Project Dashboard -> Settings -> Rate Limiting**
|
||||
|
||||

|
||||
|
||||
</Tab>
|
||||
<Tab title="Config">
|
||||
```toml
|
||||
[hasura.rateLimit]
|
||||
limit = 100
|
||||
interval = '15m'
|
||||
|
||||
[functions.rateLimit]
|
||||
limit = 100
|
||||
interval = '15m'
|
||||
|
||||
[storage.rateLimit]
|
||||
limit = 100
|
||||
interval = '15m'
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Auth
|
||||
|
||||
Given that not all endpoints are equally sensitive, Auth supports more complex rate-limiting rules, allowing you to set different configurations depending on the properties of each endpoint.
|
||||
|
||||
| Endpoints | Key | Limits | Description | Minimum version |
|
||||
| ----------------------|-----|--------|-------------|-----------------|
|
||||
| Any that sends emails<sup>1</sup> | Global | 50 / hour | Not configurable. This limit applies to any project without custom SMTP settings | 0.33.0 |
|
||||
| Any that sends emails<sup>1</sup> | Client IP | 10 / hour | Configurable. This limit applies to any project with custom SMTP settings and is configurable | 0.33.0 |
|
||||
| Any that sends SMS<sup>2</sup> | Client IP | 10 / hour | Configurable. | 0.33.0 |
|
||||
| Any endpoint that an attacker may try to brute-force. This includes sign-in and verify endpoints<sup>3</sup> | Client IP | 10 / 5 minutes | Configurable | 0.33.0 |
|
||||
| Signup endpoints<sup>4</sup> | Client IP | 10 / 5 minutes | Configurable | 0.33.0 |
|
||||
| Any | Client IP | 100 / minute | The total sum of requests to any endpoint (including previous ones) can not exceed this limit | 0.33.0 |
|
||||
|
||||
<Note>
|
||||
Limits are grouped within a given category. For instance, with a limit of 10 per hour for the sign-in/verify category, if a user attempts to sign in 10 times and then tries to verify an OTP code, the latter will be rate-limited alongside the sign-in attempts.
|
||||
</Note>
|
||||
|
||||
<sup>1</sup> Paths included:
|
||||
- `/signin/passwordless/email`
|
||||
- `/user/email/change`
|
||||
- `/user/email/send-verification-email`
|
||||
- `/user/password/reset`
|
||||
- `/signup/email-password` - If email verification enabled
|
||||
- `/user/deanonymize` - If email verification enabled
|
||||
|
||||
<sup>2</sup> Paths included:
|
||||
- `/signin/passwordless/sms`
|
||||
|
||||
<sup>3</sup> Paths included:
|
||||
- `/signin/*`
|
||||
- `*/verify`
|
||||
- `*/otp`
|
||||
|
||||
<sup>4</sup> Paths included:
|
||||
- `/signup/*`
|
||||
|
||||
|
||||
### Configuration
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Dashboard">
|
||||
**Project Dashboard -> Settings -> Rate Limiting**
|
||||
|
||||

|
||||
|
||||
</Tab>
|
||||
<Tab title="Config">
|
||||
```toml
|
||||
[auth.rateLimit]
|
||||
[auth.rateLimit.emails]
|
||||
limit = 10
|
||||
interval = '1h'
|
||||
|
||||
[auth.rateLimit.sms]
|
||||
limit = 10
|
||||
interval = '1h'
|
||||
|
||||
[auth.rateLimit.bruteForce]
|
||||
limit = 10
|
||||
interval = '5m'
|
||||
|
||||
[auth.rateLimit.signups]
|
||||
limit = 10
|
||||
interval = '5m'
|
||||
|
||||
[auth.rateLimit.global]
|
||||
limit = 100
|
||||
interval = '1m'
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
Reference in New Issue
Block a user