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: src/content/docs/cloudflare-challenges/challenge-types/javascript-detections.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,9 @@ Refer to the steps below to enable and enforce JavaScript Detections.
17
17
18
18
## 1. Enable JavaScript Detections
19
19
20
-
For Bot Fight Mode customers, JavaScript Detections are automatically enabled and cannot be disabled.
20
+
For Bot Fight Mode customers, JavaScript Detections is automatically enabled and cannot be disabled.
21
21
22
-
For Super Bot Fight Mode and Bot Management for Enterprise customers, JavaScript Detections are optional.
22
+
For Super Bot Fight Mode and Bot Management for Enterprise customers, JavaScript Detections is optional.
23
23
24
24
<Renderfile="javascript-detections-enable" />
25
25
@@ -33,9 +33,9 @@ Refer to the [WAF documentation](/waf/custom-rules/create-dashboard/) for more i
33
33
34
34
## API
35
35
36
-
If you enable JavaScript Detections via the dashboard, Cloudflare will insert a script tag in all HTML pages served on your website. If you would prefer to limit where JavaScript Detections are served, you can do so with the JavaScript Detections API script.
36
+
If you enable JavaScript Detections via the dashboard, Cloudflare will insert a script tag in all HTML pages served on your website. If you would prefer to limit where JavaScript Detections is served, you can do so with the JavaScript Detections API script.
37
37
38
-
The JavaScript Detections API allows you more granular control over when and where JavaScript Detections are injected on your website, as well as an option for callback handling (for logging or other additional actions).
38
+
The JavaScript Detections API allows you more granular control over when and where JavaScript Detections is injected on your website, as well as an option for callback handling (for logging or other additional actions).
39
39
40
40
You can explicitly add a script reference to `/cdn-cgi/challenge-platform/scripts/jsd/api.js` and your own code calling `window.cloudflare.jsd.executeOnce` on specific HTML pages of your website.
41
41
@@ -66,10 +66,10 @@ function jsdOnload(){
66
66
67
67
## Considerations
68
68
69
-
JavaScript Detections do not guarantee a specific bot score.
69
+
JavaScript Detections does not guarantee a specific bot score.
70
70
71
-
- If the JavaScript Detections injection or execution fails and `cf.bot_management.js_detection.passed` = `false`, a separate Bot Management heuristic can still yield a 1 or higher bot score, independent of JavaScript Detections.
72
-
- If the JavaScript Detections pass, the final bot score may still be 1 due to other detection heuristics (for example, known malicious IP, signature detection, and more), resulting in `js_detection.passed` = `true`, but `score` = 1.
71
+
- If the JavaScript Detections injection or execution fails and `cf.bot_management.js_detection.passed` = `false`, a separate Bot Management heuristic can still yield a `1` or higher bot score, independent of JavaScript Detections.
72
+
- If the JavaScript Detections passes, the final bot score may still be `1` due to other detection heuristics (for example, known malicious IP, signature detection, and more), resulting in `js_detection.passed` = `true`, but `score` = `1`.
73
73
74
74
## Limitations
75
75
@@ -89,7 +89,7 @@ Subsequent requests can include a `cf_clearance` cookie if JavaScript ran succes
89
89
90
90
:::caution[Warning]
91
91
92
-
JavaScript Detections are not supported with `nonce` set via `<meta>` tags.
92
+
JavaScript Detections is not supported with `nonce` set via `<meta>` tags.
Challenge Pages and Turnstile rely on the same underlying mechanism to issue Challenges to your website or application's visitors.
21
21
22
-
JavaScript Detections support Cloudflare's Enterprise Bot Management. While it still relies on client-side detections, JavaScript Detections function using a more performant challenge logic than Challenge Pages or Turnstile.
22
+
JavaScript Detections supports Cloudflare's Enterprise Bot Management. While it still relies on client-side detections, JavaScript Detections function using a more performant challenge logic than Challenge Pages or Turnstile.
Copy file name to clipboardExpand all lines: src/content/partials/cloudflare-challenges/javascript-detections-csp.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,4 +12,4 @@ If you have a <GlossaryTooltip term="content security policy (CSP)">Content Secu
12
12
13
13
- If your CSP uses a `nonce` for script tags, Cloudflare will add these nonces to the scripts it injects by parsing your CSP response header.
14
14
15
-
- If your CSP does not use `nonce` for script tags and **JavaScript Detections**are enabled, you may see a console error such as `Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-b123b8a70+4jEj+d6gWI9U6IilUJIrlnRJbRR/uQl2Jc='), or a nonce ('nonce-...') is required to enable inline execution.` We highly discourage the use of `unsafe-inline` and instead recommend the use CSP `nonces` in script tags which we parse and support in our CDN.
15
+
- If your CSP does not use `nonce` for script tags and **JavaScript Detections**is enabled, you may see a console error such as `Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-b123b8a70+4jEj+d6gWI9U6IilUJIrlnRJbRR/uQl2Jc='), or a nonce ('nonce-...') is required to enable inline execution.` We highly discourage the use of `unsafe-inline` and instead recommend the use CSP `nonces` in script tags which we parse and support in our CDN.
Copy file name to clipboardExpand all lines: src/content/partials/cloudflare-challenges/javascript-detections-definition.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,6 @@
4
4
5
5
import { Markdown } from"~/components"
6
6
7
-
JavaScript Detections is a type of Challenge separate from Cloudflare’s Challenge Pages or Turnstile. Javascript Detections help Cloudflare’s [bot solutions](/bots/) identify automated requests.
7
+
JavaScript Detections is a type of Challenge separate from Cloudflare’s Challenge Pages or Turnstile. Javascript Detections helps Cloudflare's [bot solutions](/bots/) identify automated requests.
8
8
9
-
While Challenge Pages and Turnstile rely on client-side signals to determine the authenticity of a request, Bot Management’s JavaScript Detections rely on network-side signals and run on every single request made to your website.
9
+
While Challenge Pages and Turnstile rely on client-side signals to determine the authenticity of a request, Bot Management’s JavaScript Detections relies on network-side signals and run on every single request made to your website.
Copy file name to clipboardExpand all lines: src/content/partials/cloudflare-challenges/javascript-detections-implementation.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ When adding this field to WAF custom rules, it is used on endpoints expecting br
11
11
12
12
### Prerequisites
13
13
14
-
- You must have JavaScript detections enabled on your zone.
14
+
- You must have JavaScript Detections enabled on your zone.
15
15
- You must have [updated your Content Security Policy headers](/cloudflare-challenges/challenge-types/javascript-detections/#if-you-have-a-content-security-policy-csp) for JavaScript detections.
16
16
- You must not run this field on websocket endpoints.
17
17
- You must use the field in a custom rules expression that expects only browser traffic.
Copy file name to clipboardExpand all lines: src/content/partials/cloudflare-challenges/javascript-detections-process.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ import { Markdown } from "~/components";
6
6
7
7
## Process
8
8
9
-
JavaScript Detections are implemented on your website via a lightweight, invisible JavaScript code snippet that follows Cloudflare's [privacy standards](https://www.cloudflare.com/privacypolicy/).
9
+
JavaScript Detections is implemented on your website via a lightweight, invisible JavaScript code snippet that follows Cloudflare's [privacy standards](https://www.cloudflare.com/privacypolicy/).
10
10
11
11
JavaScript is injected only in response to requests for HTML pages or page views, excluding AJAX calls. API and mobile application traffic is unaffected.
12
12
13
-
JavaScript Detections have a lifespan of 15 minutes. However, the code is injected again before the session expires. After page load, the script is deferred and utilizes a separate thread (where available) to ensure that performance impact is minimal. The snippets of JavaScript will contain a source pointing to the Challenge Platform, with paths that start with `/cdn-cgi/challenge-platform/…`
13
+
JavaScript Detections has a lifespan of 15 minutes. However, the code is injected again before the session expires. After page load, the script is deferred and utilizes a separate thread (where available) to ensure that performance impact is minimal. The snippets of JavaScript will contain a source pointing to the Challenge Platform, with paths that start with `/cdn-cgi/challenge-platform/…`
14
14
15
-
Once the JavaScript Detection is injected on the HTML page, the visitor's browser will run the JavaScript code snippet and a `cf_clearance` cookie is issued to the visitor. The information in JavaScript Detections is stored in the `cf_clearance` cookie and is used to populate `js_detection.passed`.
15
+
Once JavaScript Detections is injected on the HTML page, the visitor's browser will run the JavaScript code snippet and a `cf_clearance` cookie is issued to the visitor. The information in JavaScript Detections is stored in the `cf_clearance` cookie and is used to populate `js_detection.passed`.
16
16
17
17
- If the visitor is verified and a `cf_clearance` cookie is issued, it will contain the outcome: `cf.bot_management.js.detection.passed` = `true`
18
18
- If the verification fails, the cookie will contain the outcome: `cf.bot_management.js.detection.passed` = `false`
@@ -22,7 +22,7 @@ The `cf_clearance` cookie cannot exceed the maximum size of 4096 bytes.
22
22
:::
23
23
24
24
:::caution
25
-
Enforcement against bots do**not** occur even if the cookie is flagged false.
25
+
Enforcement against bots does**not** occur even if the cookie is flagged false.
26
26
27
27
You must enable JavaScript Detections and then create a custom WAF rule using the `cf.bot_management.js.detection.passed` field to block or challenge a failed request.
0 commit comments