Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Apply suggestions from code review

Joel Lee2d9c7479f04f
diff --git a/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx b/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx
index 29a8281be43..bb7c78102cf 100644
--- a/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx
+++ b/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx
@@ -19,7 +19,9 @@ toc_depth: 3
## Background
-Today, we’re releasing Multi Factor Authentication for everyone. We are also excited to commence the dogfooding of SAML support via the introduction of Single Sign On (SSO) on our dashboard - you can contact us at [[email protected]](mailto:[email protected]) if you want to [enable this in your Enterprise or Pro plan](https://docs.supabase.com/guides/platform/sso/enable-sso).
+Today, we’re releasing Multi Factor Authentication for everyone.
+
+Additionally, in preparation for releasing SAML, we're "dogfooding" the feature with the introduction of Single Sign On (SSO) on our dashboard. Contact us at [[email protected]](mailto:[email protected]) if you want to [enable this in your Enterprise or Pro plan](https://docs.supabase.com/guides/platform/sso/enable-sso).
## What is MFA?
@@ -30,7 +32,7 @@ Multi-factor authentication (MFA), sometimes called two-factor authentication (2
[TOTP](https://www.rfc-editor.org/rfc/rfc6238) works by generating a unique, one-time password that is valid for a limited amount of time, usually 30 seconds or less. This password is generated using a shared secret key that is known only to the device and Supabase Auth, along with the current time. To exchange the shared secret key, a user scans a QR code generated by the server in order to establish a connection. The QR code can be represented by a URI which conforms to the [Google Authenticator Key URI format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format):
-```jsx
+```bash
otpauth://totp/supabase.io:[email protected]?algorithm=SHA1&digits=6&issuer=supabase.io&period=30&secret=BFSXQHFB2BGAZIOQWCDBJUF7B54A52JQ
```
@@ -47,7 +49,7 @@ An MFA flow can be broken into two key steps: Enrollment and Verification. Durin
To generate a QR code, call the `/enroll` endpoint which returns an SVG encoded QR and the secret. Thereafter, create a challenge by calling the `/challenge` endpoint. Once the user has entered the six digit TOTP code generated by their authenticator app, call the`/verify` endpoint with the corresponding factor and challenge details.
-You might wonder: why the need for the challenge step? The challenge step is designed to create an interval between MFA initiation and the action of making a verification. This is useful in cases like Yubikey authentication where a user might need to request a challenge before placing their finger on the device.
+You might wonder: why the need for the "challenge" step? This step creates an interval between MFA initiation and the action of making a verification. This is useful in cases like Yubikey authentication where a user might need to request a challenge before placing their finger on the device.
![MFA Enrollment Flow](/images/blog/lw6-auth/enrollment_flow.png)
@@ -62,7 +64,7 @@ On subsequent logins attempts, redirect a user to an MFA verification after they
## Enforcement via Row Level Security
-Adding MFA to your project and not enforcing it is like buying an expensive door and never locking it. We love Postgres RLS at Supabase and we believe it plays a key role in facilitating custom checks for a spread of use cases. To support RLS integration, JWTs issued by Supabase Auth now contain two additional pieces of information:
+Using MFA without enforcing it is like buying an expensive door and never locking it. We love Postgres RLS at Supabase. To support RLS integration, JWTs issued by Supabase Auth now contain two additional pieces of information:
1. An Authenticator Assurance Level (AAL) claim. Use this to quickly identify the level of identity checks the user has performed. `aal1` is reserved for conventional sign in, while `aal2` is issued only after the user has verified with an additional factor.
2. An Authenticator Method Reference (AMR) claim. Use this to identify all of the authentication methods used by the user. This is also useful if you wish to implement step-up login scenarios.
@@ -119,7 +121,7 @@ create policy "Allow access on table only if user has gone through MFA"
*Enforce MFA for selected users*
-Note that both RLS policies are restrictive. By default, overlapping policies in PostgreSQL are permissive rather than restrictive. This means that RLS policies are combined with an OR clause and only one policy needs to pass in order for a row to be operated on. Therefore, we set RLS policies as restrictive in order to allow for enforcement based on checks from multiple policies.
+Note that both RLS policies are restrictive. By default, overlapping policies in PostgreSQL are permissive rather than restrictive. This means that RLS policies are combined with an `OR` clause and only one policy needs to pass in order for a row to be operated on. Therefore, we set RLS policies as restrictive to enforce the checks from multiple policies.
Be mindful of your user’s preference, though. If a user has enabled MFA, they are expecting a higher level of security for their account. Consequently, we recommend that developers enforce MFA across all operations if a user has MFA enabled. You can check out [our MFA guide](https://supabase.com/docs/guides/auth/auth-mfa) for more details about MFA enforcement.