You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/docs/advanced/security/http-basic-auth.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -54,9 +54,9 @@ But by using the `secrets.compare_digest()` it will be secure against a type of
54
54
55
55
But what's a "timing attack"?
56
56
57
-
Let's imagine an attacker is trying to guess the username and password.
57
+
Let's imagine some attackers are trying to guess the username and password.
58
58
59
-
And that attacker sends a request with a username `johndoe` and a password `love123`.
59
+
And they send a request with a username `johndoe` and a password `love123`.
60
60
61
61
Then the Python code in your application would be equivalent to something like:
62
62
@@ -67,7 +67,7 @@ if "johndoe" == "stanleyjobson" and "love123" == "swordfish":
67
67
68
68
But right at the moment Python compares the first `j` in `johndoe` to the first `s` in `stanleyjobson`, it will return `False`, because it already knows that those two strings are not the same, thinking that "there's no need to waste more computation comparing the rest of the letters". And your application will say "incorrect user or password".
69
69
70
-
But then the attacker tries with username `stanleyjobsox` and password `love123`.
70
+
But then the attackers try with username `stanleyjobsox` and password `love123`.
71
71
72
72
And your application code does something like:
73
73
@@ -78,17 +78,17 @@ if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
78
78
79
79
Python will have to compare the whole `stanleyjobso` in both `stanleyjobsox` and `stanleyjobson` before realizing that both strings are not the same. So it will take some extra microseconds to reply back "incorrect user or password".
80
80
81
-
#### The time to answer helps the attacker
81
+
#### The time to answer helps the attackers
82
82
83
-
At that point, by noticing that the server took some microseconds longer to send the "incorrect user or password" response, the attacker will know that she/he got _something_ right, some of the initial letters were right.
83
+
At that point, by noticing that the server took some microseconds longer to send the "incorrect user or password" response, the attackers will know that they got _something_ right, some of the initial letters were right.
84
84
85
-
And then she/he can try again knowing that it's probably something more similar to `stanleyjobsox` than to `johndoe`.
85
+
And then they can try again knowing that it's probably something more similar to `stanleyjobsox` than to `johndoe`.
86
86
87
87
#### A "professional" attack
88
88
89
-
Of course, the attacker would not try all this by hand, she/he would write a program to do it, possibly with thousands or millions of tests per second. And would get just one extra correct letter at a time.
89
+
Of course, the attackers would not try all this by hand, they would write a program to do it, possibly with thousands or millions of tests per second. And would get just one extra correct letter at a time.
90
90
91
-
But doing that, in some minutes or hours the attacker would have guessed the correct username and password, with the "help" of our application, just using the time taken to answer.
91
+
But doing that, in some minutes or hours the attackers would have guessed the correct username and password, with the "help" of our application, just using the time taken to answer.
Copy file name to clipboardExpand all lines: docs/en/docs/tutorial/background-tasks.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
You can define background tasks to be run *after* returning a response.
4
4
5
-
This is useful for operations that need to happen after a request, but that the client doesn't really have to be waiting for the operation to complete before receiving his response.
5
+
This is useful for operations that need to happen after a request, but that the client doesn't really have to be waiting for the operation to complete before receiving the response.
Copy file name to clipboardExpand all lines: docs/en/docs/tutorial/handling-errors.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -47,15 +47,15 @@ In this example, when the client request an item by an ID that doesn't exist, ra
47
47
48
48
### The resulting response
49
49
50
-
If the client requests `http://example.com/items/foo` (an `item_id``"foo"`), he will receive an HTTP status code of 200, and a JSON response of:
50
+
If the client requests `http://example.com/items/foo` (an `item_id``"foo"`), that client will receive an HTTP status code of 200, and a JSON response of:
51
51
52
52
```JSON
53
53
{
54
54
"item": "The Foo Wrestlers"
55
55
}
56
56
```
57
57
58
-
But if the client requests `http://example.com/items/bar` (a non-existent `item_id``"bar"`), he will receive an HTTP status code of 404 (the "not found" error), and a JSON response of:
58
+
But if the client requests `http://example.com/items/bar` (a non-existent `item_id``"bar"`), that client will receive an HTTP status code of 404 (the "not found" error), and a JSON response of:
Copy file name to clipboardExpand all lines: docs/en/docs/tutorial/security/oauth2-jwt.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ It is not encrypted, so, anyone could recover the information from the contents.
20
20
21
21
But it's signed. So, when you receive a token that you emitted, you can verify that you actually emitted it.
22
22
23
-
That way, you can create a token with an expiration of, let's say, 1 week. And then when the user comes back the next day with the token, you know she/he is still logged in to your system.
23
+
That way, you can create a token with an expiration of, let's say, 1 week. And then when the user comes back the next day with the token, you know that user is still logged in to your system.
24
24
25
25
After a week, the token will be expired and the user will not be authorized and will have to sign in again to get a new token. And if the user (or a third party) tried to modify the token to change the expiration, you would be able to discover it, because the signatures would not match.
0 commit comments