Skip to content

Commit d22d2df

Browse files
Oxyjunthibmeu
andauthored
Review part 1 - inline suggestions
Co-authored-by: Thibault <[email protected]>
1 parent d49ba64 commit d22d2df

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/content/docs/bots/concepts/bot/verified-bots/web-bot-auth.mdx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import { GlossaryTooltip, Steps } from "~/components"
1111

1212
Web Bot Auth is an authentication method that leverages cryptographic signatures in HTTP messages to verify that a request comes from an automated bot.
1313

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+
1418
## 1. Generate a valid signing key
1519

1620
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
3842

3943
## 2. Host a key directory
4044

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).
4247

4348
<Steps>
4449
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
8287
</Steps>
8388

8489
:::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.
8691

8792
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.
8893
:::
@@ -112,7 +117,8 @@ After successful verification, you will be able to send verified requests.
112117

113118
## 4. (After verification) Sign your requests
114119

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+
116122

117123
### 4.1. Choose a set of components to sign
118124

@@ -129,7 +135,7 @@ A component is either an HTTP header, or any [derived components](https://www.rf
129135

130136
### 4.2. Calculate the JWK thumbprint
131137

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.
133139

134140
### 4.3. Construct the required headers
135141

@@ -153,9 +159,9 @@ Construct a [`Signature` header](https://www.rfc-editor.org/rfc/rfc9421#name-the
153159

154160
#### `Signature-Agent` header
155161

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:
157163
- 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.
159165
- The message has a valid `Signature-Agent` header, but does not include it in the component list in `Signature-Input`.
160166

161167
### 4.4. Add the headers to your bot's requests

src/content/docs/bots/frequently-asked-questions.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ Note that you need to replace `<API_TOKEN>` with your own [API token](/fundament
178178

179179
### What key algorithms does Cloudflare support?
180180

181-
Cloudflare does not support key algorithms other than Ed25519.
181+
Cloudflare supports Ed25519 key algorithm.
182182

183183
---
184184

185-
### What `web-bot-auth` features from the spec are not supported?
185+
### What `web-bot-auth` features from the IETF draft are not supported?
186186

187187
The following derived components are not supported, and we will fail to verify a message if they are included:
188188

0 commit comments

Comments
 (0)