Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/

This commit is contained in:
Translator
2024-12-31 20:18:58 +00:00
parent 820dd99aed
commit 931ae54e5f
245 changed files with 9984 additions and 12710 deletions

View File

@@ -1,50 +1,49 @@
# Supabase Security
# Sicurezza di Supabase
{{#include ../banners/hacktricks-training.md}}
## Basic Information
## Informazioni di base
As per their [**landing page**](https://supabase.com/): Supabase is an open source Firebase alternative. Start your project with a Postgres database, Authentication, instant APIs, Edge Functions, Realtime subscriptions, Storage, and Vector embeddings.
Secondo la loro [**pagina di atterraggio**](https://supabase.com/): Supabase è un'alternativa open source a Firebase. Inizia il tuo progetto con un database Postgres, Autenticazione, API istantanee, Funzioni Edge, abbonamenti in tempo reale, Archiviazione e Embedding vettoriali.
### Subdomain
### Sottodominio
Basically when a project is created, the user will receive a supabase.co subdomain like: **`jnanozjdybtpqgcwhdiz.supabase.co`**
Fondamentalmente, quando viene creato un progetto, l'utente riceverà un sottodominio supabase.co come: **`jnanozjdybtpqgcwhdiz.supabase.co`**
## **Database configuration**
## **Configurazione del database**
> [!TIP]
> **This data can be accessed from a link like `https://supabase.com/dashboard/project/<project-id>/settings/database`**
> **Questi dati possono essere accessibili tramite un link come `https://supabase.com/dashboard/project/<project-id>/settings/database`**
This **database** will be deployed in some AWS region, and in order to connect to it it would be possible to do so connecting to: `postgres://postgres.jnanozjdybtpqgcwhdiz:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:5432/postgres` (this was crated in us-west-1).\
The password is a **password the user put** previously.
Questo **database** sarà distribuito in una regione AWS e, per connettersi ad esso, sarà possibile farlo collegandosi a: `postgres://postgres.jnanozjdybtpqgcwhdiz:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:5432/postgres` (questo è stato creato in us-west-1).\
La password è una **password che l'utente ha inserito** in precedenza.
Therefore, as the subdomain is a known one and it's used as username and the AWS regions are limited, it might be possible to try to **brute force the password**.
Pertanto, poiché il sottodominio è noto ed è utilizzato come nome utente e le regioni AWS sono limitate, potrebbe essere possibile provare a **forzare la password**.
This section also contains options to:
Questa sezione contiene anche opzioni per:
- Reset the database password
- Configure connection pooling
- Configure SSL: Reject plan-text connections (by default they are enabled)
- Configure Disk size
- Apply network restrictions and bans
- Reimpostare la password del database
- Configurare il pooling delle connessioni
- Configurare SSL: Rifiuta le connessioni in testo semplice (per impostazione predefinita sono abilitate)
- Configurare la dimensione del disco
- Applicare restrizioni e divieti di rete
## API Configuration
## Configurazione API
> [!TIP]
> **This data can be accessed from a link like `https://supabase.com/dashboard/project/<project-id>/settings/api`**
> **Questi dati possono essere accessibili tramite un link come `https://supabase.com/dashboard/project/<project-id>/settings/api`**
The URL to access the supabase API in your project is going to be like: `https://jnanozjdybtpqgcwhdiz.supabase.co`.
L'URL per accedere all'API supabase nel tuo progetto sarà simile a: `https://jnanozjdybtpqgcwhdiz.supabase.co`.
### anon api keys
### chiavi API anonime
It'll also generate an **anon API key** (`role: "anon"`), like: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTQ5OTI3MTksImV4cCI6MjAzMDU2ODcxOX0.sRN0iMGM5J741pXav7UxeChyqBE9_Z-T0tLA9Zehvqk` that the application will need to use in order to contact the API key exposed in our example in
Genererà anche una **chiave API anonima** (`role: "anon"`), come: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTQ5OTI3MTksImV4cCI6MjAzMDU2ODcxOX0.sRN0iMGM5J741pXav7UxeChyqBE9_Z-T0tLA9Zehvqk` che l'applicazione dovrà utilizzare per contattare la chiave API esposta nel nostro esempio in
It's possible to find the API REST to contact this API in the [**docs**](https://supabase.com/docs/reference/self-hosting-auth/returns-the-configuration-settings-for-the-gotrue-server), but the most interesting endpoints would be:
È possibile trovare l'API REST per contattare questa API nella [**documentazione**](https://supabase.com/docs/reference/self-hosting-auth/returns-the-configuration-settings-for-the-gotrue-server), ma gli endpoint più interessanti sarebbero:
<details>
<summary>Signup (/auth/v1/signup)</summary>
<summary>Registrazione (/auth/v1/signup)</summary>
```
POST /auth/v1/signup HTTP/2
Host: id.io.net
@@ -69,13 +68,11 @@ Priority: u=1, i
{"email":"test@exmaple.com","password":"SomeCOmplexPwd239."}
```
</details>
<details>
<summary>Login (/auth/v1/token?grant_type=password)</summary>
<summary>Accesso (/auth/v1/token?grant_type=password)</summary>
```
POST /auth/v1/token?grant_type=password HTTP/2
Host: hypzbtgspjkludjcnjxl.supabase.co
@@ -100,68 +97,63 @@ Priority: u=1, i
{"email":"test@exmaple.com","password":"SomeCOmplexPwd239."}
```
</details>
So, whenever you discover a client using supabase with the subdomain they were granted (it's possible that a subdomain of the company has a CNAME over their supabase subdomain), you might try to **create a new account in the platform using the supabase API**.
Quindi, ogni volta che scopri un cliente che utilizza supabase con il sottodominio che gli è stato assegnato (è possibile che un sottodominio dell'azienda abbia un CNAME sul loro sottodominio supabase), potresti provare a **creare un nuovo account nella piattaforma utilizzando l'API di supabase**.
### secret / service_role api keys
### chiavi api segrete / service_role
A secret API key will also be generated with **`role: "service_role"`**. This API key should be secret because it will be able to bypass **Row Level Security**.
Una chiave API segreta verrà generata anche con **`role: "service_role"`**. Questa chiave API dovrebbe essere segreta perché sarà in grado di bypassare **Row Level Security**.
The API key looks like this: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcxNDk5MjcxOSwiZXhwIjoyMDMwNTY4NzE5fQ.0a8fHGp3N_GiPq0y0dwfs06ywd-zhTwsm486Tha7354`
La chiave API appare così: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcxNDk5MjcxOSwiZXhwIjoyMDMwNTY4NzE5fQ.0a8fHGp3N_GiPq0y0dwfs06ywd-zhTwsm486Tha7354`
### JWT Secret
### Segreto JWT
A **JWT Secret** will also be generate so the application can **create and sign custom JWT tokens**.
Un **JWT Secret** verrà generato anche affinché l'applicazione possa **creare e firmare token JWT personalizzati**.
## Authentication
## Autenticazione
### Signups
### Registrazioni
> [!TIP]
> By **default** supabase will allow **new users to create accounts** on your project by using the previously mentioned API endpoints.
> Per **default** supabase consentirà **ai nuovi utenti di creare account** nel tuo progetto utilizzando gli endpoint API precedentemente menzionati.
However, these new accounts, by default, **will need to validate their email address** to be able to login into the account. It's possible to enable **"Allow anonymous sign-ins"** to allow people to login without verifying their email address. This could grant access to **unexpected data** (they get the roles `public` and `authenticated`).\
This is a very bad idea because supabase charges per active user so people could create users and login and supabase will charge for those:
Tuttavia, questi nuovi account, per impostazione predefinita, **dovranno convalidare il loro indirizzo email** per poter accedere all'account. È possibile abilitare **"Consenti accessi anonimi"** per consentire alle persone di accedere senza verificare il loro indirizzo email. Questo potrebbe concedere accesso a **dati inaspettati** (ottengono i ruoli `public` e `authenticated`).\
Questa è un'idea molto cattiva perché supabase addebita per utente attivo, quindi le persone potrebbero creare utenti e accedere e supabase addebiterà per questi:
<figure><img src="../images/image (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
### Passwords & sessions
### Password e sessioni
It's possible to indicate the minimum password length (by default), requirements (no by default) and disallow to use leaked passwords.\
It's recommended to **improve the requirements as the default ones are weak**.
È possibile indicare la lunghezza minima della password (per impostazione predefinita), i requisiti (nessuno per impostazione predefinita) e vietare l'uso di password compromesse.\
Si consiglia di **migliorare i requisiti poiché quelli predefiniti sono deboli**.
- User Sessions: It's possible to configure how user sessions work (timeouts, 1 session per user...)
- Bot and Abuse Protection: It's possible to enable Captcha.
- Sessioni utente: È possibile configurare come funzionano le sessioni utente (timeout, 1 sessione per utente...)
- Protezione da bot e abusi: È possibile abilitare Captcha.
### SMTP Settings
### Impostazioni SMTP
It's possible to set an SMTP to send emails.
È possibile impostare un SMTP per inviare email.
### Advanced Settings
### Impostazioni avanzate
- Set expire time to access tokens (3600 by default)
- Set to detect and revoke potentially compromised refresh tokens and timeout
- MFA: Indicate how many MFA factors can be enrolled at once per user (10 by default)
- Max Direct Database Connections: Max number of connections used to auth (10 by default)
- Max Request Duration: Maximum time allowed for an Auth request to last (10s by default)
- Imposta il tempo di scadenza per i token di accesso (3600 per impostazione predefinita)
- Imposta per rilevare e revocare i token di aggiornamento potenzialmente compromessi e timeout
- MFA: Indica quanti fattori MFA possono essere registrati contemporaneamente per utente (10 per impostazione predefinita)
- Max Connessioni Dirette al Database: Numero massimo di connessioni utilizzate per l'autenticazione (10 per impostazione predefinita)
- Massima Durata della Richiesta: Tempo massimo consentito per una richiesta di autenticazione (10s per impostazione predefinita)
## Storage
## Archiviazione
> [!TIP]
> Supabase allows **to store files** and make them accesible over a URL (it uses S3 buckets).
> Supabase consente **di archiviare file** e renderli accessibili tramite un URL (utilizza bucket S3).
- Set the upload file size limit (default is 50MB)
- The S3 connection is given with a URL like: `https://jnanozjdybtpqgcwhdiz.supabase.co/storage/v1/s3`
- It's possible to **request S3 access key** that are formed by an `access key ID` (e.g. `a37d96544d82ba90057e0e06131d0a7b`) and a `secret access key` (e.g. `58420818223133077c2cec6712a4f909aec93b4daeedae205aa8e30d5a860628`)
- Imposta il limite di dimensione del file da caricare (il predefinito è 50MB)
- La connessione S3 è fornita con un URL come: `https://jnanozjdybtpqgcwhdiz.supabase.co/storage/v1/s3`
- È possibile **richiedere una chiave di accesso S3** che è formata da un `access key ID` (ad es. `a37d96544d82ba90057e0e06131d0a7b`) e una `secret access key` (ad es. `58420818223133077c2cec6712a4f909aec93b4daeedae205aa8e30d5a860628`)
## Edge Functions
## Funzioni Edge
It's possible to **store secrets** in supabase also which will be **accessible by edge functions** (the can be created and deleted from the web, but it's not possible to access their value directly).
È possibile **archiviare segreti** in supabase che saranno **accessibili dalle funzioni edge** (possono essere create e eliminate dal web, ma non è possibile accedere direttamente al loro valore).
{{#include ../banners/hacktricks-training.md}}