Skip to content

Commit f12f3f9

Browse files
authored
chore: merge pull request #1293 from logto-io/rany-account-api-security-policy
chore: account api security policy
2 parents 8e86c71 + 4b7fcdb commit f12f3f9

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

docs/end-user-flows/account-settings/by-account-api.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ curl -X POST https://[tenant-id].logto.app/api/my-account/password \
219219
--data-raw '{"password":"..."}'
220220
```
221221

222+
:::tip
223+
Just like passwords created during sign-up, passwords set through the Account API must comply with the [password policy](/security/password-policy) you configured in <CloudLink to="/security/password-policy">Console > Security > Password policy</CloudLink>. Logto returns detailed validation results and error messages if the password fails the policy.
224+
:::
225+
222226
### Update or link new email \{#update-or-link-new-email}
223227

224228
:::note
@@ -255,6 +259,10 @@ curl -X POST https://[tenant-id].logto.app/api/my-account/primary-email \
255259
--data-raw '{"email":"...","newIdentifierVerificationRecordId":"..."}'
256260
```
257261

262+
:::tip
263+
Just like emails collected during sign-up, any email linked through the Account API must pass the [blocklist](/security/blocklist) verification you configured in <CloudLink to="/security/blocklist">Console > Security > Blocklist</CloudLink>. Logto will reject the request and return a detailed error if the email violates the policy.
264+
:::
265+
258266
### Remove the user's email \{#remove-the-users-email}
259267

260268
To remove the user's email, you can use the [`DELETE /api/my-account/primary-email`](https://openapi.logto.io/operation/operation-deleteprimaryemail) endpoint.

docs/security/blocklist.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ For instance, adding `@example.com` to the blocklist will block all email addres
2828

2929
:::note
3030

31-
Disposable emails, subaddressing, and custom email are restricted during registration and account linking. Existing users with these email addresses can still sign in.
31+
Disposable emails, subaddressing, and custom email are restricted during [new-user registration](/end-user-flows/sign-up-and-sign-in/sign-up), [linking email during social sign-in](/end-user-flows/sign-up-and-sign-in/social-sign-in#collect-sign-up-identifiers), and updating emails via [Account API](/end-user-flows/account-settings/by-account-api#update-or-link-new-email). Existing users with these email addresses can still sign in.
3232

3333
- Admins can "bypass restrictions" by manually adding users in <CloudLink to="/users">Console > User management</CloudLink>, or via [Management API](https://openapi.logto.io/operation/operation-createuser). E.g., Create an user with a subaddress email when subaddressing is blocked.
34-
- Block exsiting accounts by deleting or suspending them in <CloudLink to="/users">Console > User management</CloudLink>.
34+
- Block existing accounts by deleting or suspending them in <CloudLink to="/users">Console > User management</CloudLink>.
3535

3636
:::
3737

docs/security/password-policy.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ sidebar_position: 1
66

77
# Password policy
88

9+
Logto applies the password policy in different ways depending on how the password is created or updated:
10+
11+
- End-user flows such as [the out-of-the-box sign-in experience](/end-user-flows/sign-up-and-sign-in/sign-up), [the Experience API](/customization/bring-your-ui), and [the Account API](/end-user-flows/account-settings/by-account-api#update-users-password) always enforce the current [password policy](#set-up-password-policy).
12+
- Administrator actions via the Management API [`patch /api/users/{userId}/password`](https://openapi.logto.io/operation/operation-updateuserpassword) are exempt, allowing you to provision or reset credentials without policy checks when needed.
13+
- To audit existing passwords against the current rules, call [`POST /api/sign-in-exp/default/check-password`](https://openapi.logto.io/operation/operation-checkpasswordwithdefaultsigninexperience) and act on the returned validation result. Read [Password compliance check](#password-compliance-check) to learn more.
14+
915
## Set up password policy \{#set-up-password-policy}
1016

1117
For new users or users who are updating their password, you can set a password policy to enforce password strength requirements. Visit the <CloudLink to="/security/password-policy"> Console > Security > Password policy</CloudLink> to configure the password policy settings.
@@ -25,8 +31,11 @@ For new users or users who are updating their password, you can set a password p
2531

2632
After you update the password policy in Logto, existing users can still sign in with their current passwords. Only newly created account will be required to follow the updated policy.
2733

28-
To enforce stronger security, you can use the `POST /api/sign-in-exp/default/check-password` [API](https://openapi.logto.io/operation/operation-checkpasswordwithdefaultsigninexperience) to check whether a user's password meets the current policy defined in the default sign-in experience. If it doesn't, you can prompt the user to update their password with a custom flow using [Account API](/end-user-flows/account-settings/by-management-api#user-password-management).
34+
To enforce stronger security, you can use the `POST /api/sign-in-exp/default/check-password` [API](https://openapi.logto.io/operation/operation-checkpasswordwithdefaultsigninexperience) to check whether a user's password meets the current policy defined in the default sign-in experience. If it doesn't, you can prompt the user to update their password with a custom flow using [Account API](/end-user-flows/account-settings/by-account-api).
2935

3036
## Related resources \{#related-resources}
3137

38+
<Url href="/user-management/manage-users">Manage users</Url>
39+
<Url href="/end-user-flows/sign-up-and-sign-in">Sign-up and sign-in</Url>
40+
<Url href="/end-user-flows/account-settings/by-account-api">Account settings by Account API</Url>
3241
<Url href="https://blog.logto.io/design-your-password-policy">Design your password policy</Url>

docs/user-management/manage-users.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ After you reset the password, copy and send it to the end-user. Once the "Reset
8888

8989
You cannot set a specific password for users in the Logto Console, but you can use the [Management API](/integrate-logto/interact-with-management-api) `PATCH /api/users/{userId}/password` to specify a password.
9090

91+
## Password compliance check \{#password-compliance-check}
92+
93+
After you update the [password policy](/security/password-policy) in Logto, existing users can still sign in with their current passwords. Only newly created accounts will be required to follow the updated password policy.
94+
95+
To enforce stronger security, you can use the `POST /api/sign-in-exp/default/check-password` [API](https://openapi.logto.io/operation/operation-checkpasswordwithdefaultsigninexperience) to check whether a user's password meets the current policy defined in the default sign-in experience. If it doesn't, you can prompt the user to update their password with a custom flow using [Account API](/end-user-flows/account-settings/by-management-api#user-password-management).
96+
9197
### Manage roles of users \{#manage-roles-of-users}
9298

9399
In the "Roles" tab of the user details page, you can easily assign or remove roles to meet your desired outcome. Check [Role-based access control](/authorization/role-based-access-control) for details.

0 commit comments

Comments
 (0)