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
Web Bot Auth is an authentication method that leverages cryptographic signatures in HTTP messages to verify that a request comes from an automated bot.
13
13
14
+
It relies on two active IETF drafts: a [directory draft](https://datatracker.ietf.org/doc/html/draft-meunier-http-message-signatures-directory) allowing the crawler to share their public keys, and a [protocol draft](https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture) defining how these keys should be used to attach crawler's identity to HTTP requests.
15
+
16
+
This documentation goes over specific integration within Cloudflare.
17
+
14
18
## 1. Generate a valid signing key
15
19
16
20
You need to generate a signing key which will be used to authenticate your bot's requests.
@@ -38,7 +42,8 @@ By following these steps, you have generated a private key and a public key, the
38
42
39
43
## 2. Host a key directory
40
44
41
-
You need to host a key directory which creates a way for Cloudflare to authenticate your bot's requests.
45
+
You need to host a key directory which creates a way for your bot to authenticate its requests to Cloudflare.
46
+
This directory should follow the definition from the active IETF draft [draft-meunier-http-message-signatures-directory-01](https://datatracker.ietf.org/doc/html/draft-meunier-http-message-signatures-directory-01).
42
47
43
48
<Steps>
44
49
1. Host a key directory at a well known message signatures directory. The key directory should serve a JSON Web Key Set (JWKS) including the public key derived from your signing key.
@@ -82,7 +87,7 @@ You need to host a key directory which creates a way for Cloudflare to authentic
82
87
</Steps>
83
88
84
89
:::note
85
-
This URL serves a standard JSON Web Key Set. Besides `x`, `crv`, and `kty`, you can include other standard JSON Web Key parameters, and you may publish non-Ed25519 keys as well. Multiple Ed25519 keys are acceptable as well.
90
+
This URL serves a standard JSON Web Key Set. Besides `x`, `crv`, and `kty`, you can include other standard JSON Web Key parameters, and you may publish non-Ed25519 keys as well. Multiple Ed25519 keys are supported. Only those for which you provide a signature in the above format are going to be used.
86
91
87
92
Cloudflare will ignore all other key types and key parameters except those containing `kty`, `crv`, and `x` formatted above. Do not include information that would leak your private key, such as the `d` parameter.
88
93
:::
@@ -112,7 +117,8 @@ After successful verification, you will be able to send verified requests.
112
117
113
118
## 4. (After verification) Sign your requests
114
119
115
-
After your bot has been successfully verified, you need to sign your bot's requests.
120
+
After your bot has been successfully verified, your bot is ready to sign its requests. The signature protocol is defined in [draft-meunier-web-bot-auth-architecture-02](https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture-02)
121
+
116
122
117
123
### 4.1. Choose a set of components to sign
118
124
@@ -129,7 +135,7 @@ A component is either an HTTP header, or any [derived components](https://www.rf
129
135
130
136
### 4.2. Calculate the JWK thumbprint
131
137
132
-
[Calculate the base64 URL-encoded JWK thumbprint](https://www.rfc-editor.org/rfc/rfc8037.html#appendix-A.3)associated with your Ed25519 public key registered with Cloudflare.
138
+
[Calculate the base64 URL-encoded JWK thumbprint](https://www.rfc-editor.org/rfc/rfc8037.html#appendix-A.3)from the public key you registered with Cloudflare.
133
139
134
140
### 4.3. Construct the required headers
135
141
@@ -153,9 +159,9 @@ Construct a [`Signature` header](https://www.rfc-editor.org/rfc/rfc9421#name-the
153
159
154
160
#### `Signature-Agent` header
155
161
156
-
Construct a [`Signature-Agent` header](https://www.ietf.org/archive/id/draft-meunier-http-message-signatures-directory-00.html#name-header-field-definition) that points to your key directory. Note that Cloudflare will fail to verify a message if:
162
+
Construct a [`Signature-Agent` header](https://www.ietf.org/archive/id/draft-meunier-http-message-signatures-directory-01.html#name-header-field-definition) that points to your key directory. Note that Cloudflare will fail to verify a message if:
157
163
- The message includes a `Signature-Agent` header that is not an `https://`.
158
-
- The message includes a valid URI but do not enclose it in double quotes.
164
+
- The message includes a valid URI but does not enclose it in double quotes. This is due to Signature-Agent being a structured field.
159
165
- The message has a valid `Signature-Agent` header, but does not include it in the component list in `Signature-Input`.
0 commit comments