|
| 1 | +--- |
| 2 | +id: code-submission-limit |
| 3 | +title: Code submissions limit |
| 4 | +--- |
| 5 | + |
| 6 | +A code is sent to a user controlled address (for example an email address) in some flows such as verification, recovery, |
| 7 | +registration, etc. When the correct code is then submitted by the user, the flow advances. If the wrong code is submitted too many |
| 8 | +times, the flow fails. |
| 9 | + |
| 10 | +It is important to find a balance between allowing a user to submit a wrong code multiple times, due for example to typos, and not |
| 11 | +too many times, to prevent an attacker from brute-forcing the code. |
| 12 | + |
| 13 | +To that end, the numeric limit can be configured. The default is `5`. To prevent misconfiguration, this number is required to be |
| 14 | +between `1` and `255`. We recommend a rather small number for security reasons, probably under 10. Organizations with strict |
| 15 | +security policies might set this number to `2` or `3`. |
| 16 | + |
| 17 | +```mdx-code-block |
| 18 | +import CodeBlock from '@theme/CodeBlock' |
| 19 | +import Tabs from '@theme/Tabs'; |
| 20 | +import TabItem from '@theme/TabItem' |
| 21 | +``` |
| 22 | + |
| 23 | +````mdx-code-block |
| 24 | +<Tabs> |
| 25 | +<TabItem value="console" label="Ory Console" default> |
| 26 | +
|
| 27 | +To change the limit, go to [**Ory Console**](https://console.ory.sh/) → **Authentication** -> **General** -> **Maximum number of code submissions**, enter the desired number, and click the **Save** button. |
| 28 | +
|
| 29 | +</TabItem> |
| 30 | +<TabItem value="cloud" label="Ory CLI"> |
| 31 | +
|
| 32 | +1. Download the Ory Identities config from your project and save it to a file: |
| 33 | +
|
| 34 | + ```shell |
| 35 | + ## List all available workspaces |
| 36 | + ory list workspaces |
| 37 | +
|
| 38 | + ## List all available projects |
| 39 | + ory list projects --workspace <workspace-id> |
| 40 | +
|
| 41 | + ## Get config |
| 42 | + ory get identity-config --project <project-id> --workspace <workspace-id> --format yaml > identity-config.yaml |
| 43 | + ``` |
| 44 | +
|
| 45 | +2. Update the configuration value to the desired value: |
| 46 | +
|
| 47 | + ```yaml title="config.yml" |
| 48 | + config: |
| 49 | + selfservice: |
| 50 | + methods: |
| 51 | + code: |
| 52 | + // highlight-start |
| 53 | + max_submissions: 3 |
| 54 | + // highlight-end |
| 55 | + ``` |
| 56 | +
|
| 57 | +3. Update the Ory Identities configuration using the file you worked with: |
| 58 | +
|
| 59 | + ```shell |
| 60 | + ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml |
| 61 | + ``` |
| 62 | +
|
| 63 | +</TabItem> |
| 64 | +</Tabs> |
| 65 | +```` |
0 commit comments