Skip to content

Commit 513a16a

Browse files
csp updates (cloudflare#26547)
1 parent bd42dac commit 513a16a

File tree

4 files changed

+59
-16
lines changed

4 files changed

+59
-16
lines changed

src/content/docs/bots/get-started/bot-fight-mode.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ head:
99

1010
---
1111

12-
import { Tabs, TabItem, Steps, Render, DashButton } from '~/components';
12+
import { Tabs, TabItem, Steps, Render, DashButton, GlossaryTooltip } from '~/components';
1313

1414
Bot Fight Mode is a simple, free product that helps detect and mitigate bot traffic on your domain. When enabled, the product:
1515

@@ -98,6 +98,21 @@ You can see bot-related actions by going to **Security** > **Events**. Any reque
9898

9999
## Limitations
100100

101+
### Rules
102+
101103
You cannot bypass or skip Bot Fight Mode using the _Skip_ action in WAF custom rules or using Page Rules. _Skip_, _Bypass_, and _Allow_ actions apply to rules or rulesets running on the [Ruleset Engine](/ruleset-engine/). While Super Bot Fight Mode rules are implemented in the Ruleset Engine, Bot Fight Mode checks are not. This is why you can skip Super Bot Fight Mode, but not Bot Fight Mode. If you need to skip Bot Fight Mode, consider using [Super Bot Fight Mode](/bots/get-started/super-bot-fight-mode/).
102104

103105
Bot Fight Mode can still trigger if you have IP Access rules, but it cannot trigger if an IP Access rule matches the request. For example, the IP Access rule matches the connecting IP.
106+
107+
### JavaScript Detections
108+
109+
<Render
110+
file="jsd-availability"
111+
product="bots"
112+
params={{
113+
planType: "Bot Fight Mode",
114+
enablement: "automatically enabled and cannot be disabled"
115+
}}
116+
/>
117+
118+
<Render file="content-security-policy-limitation" product="bots" />

src/content/docs/cloudflare-challenges/challenge-types/javascript-detections.mdx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,23 @@ Refer to the steps below to enable and enforce JavaScript Detections.
4040

4141
## 1. Enable JavaScript Detections
4242

43-
For Bot Fight Mode customers, JavaScript Detections is automatically enabled and cannot be disabled.
44-
45-
For Super Bot Fight Mode and Bot Management for Enterprise customers, JavaScript Detections is optional.
43+
<Render
44+
file="jsd-availability"
45+
product="bots"
46+
params={{
47+
planType: "Bot Fight Mode",
48+
enablement: "automatically enabled and cannot be disabled"
49+
}}
50+
/>
51+
52+
<Render
53+
file="jsd-availability"
54+
product="bots"
55+
params={{
56+
planType: "Super Bot Fight Mode and Bot Management for Enterprise",
57+
enablement: "optional"
58+
}}
59+
/>
4660

4761
<Render file="javascript-detections-enable" product="cloudflare-challenges" />
4862

@@ -140,18 +154,7 @@ Subsequent requests can include a `cf_clearance` cookie if JavaScript ran succes
140154
141155
### If you have a Content Security Policy (CSP)
142156
143-
If you have a <GlossaryTooltip term="content security policy (CSP)">Content Security Policy (CSP)</GlossaryTooltip>, you need to take additional steps to implement JavaScript Detections:
144-
145-
- Ensure that anything under `/cdn-cgi/challenge-platform/` is allowed. Your CSP should allow scripts served from your origin domain (`script-src self`).
146-
- For `nonce` script tags:
147-
- 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.
148-
149-
- 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.
150-
151-
:::caution[Warning]
152-
153-
JavaScript Detections is not supported with `nonce` set via `<meta>` tags.
154-
:::
157+
<Render file="content-security-policy-limitation" product="bots" />
155158
156159
### If you have ETags
157160
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
{}
3+
4+
---
5+
6+
import { GlossaryTooltip } from '~/components';
7+
8+
If you have a <GlossaryTooltip term="content security policy (CSP)">Content Security Policy (CSP)</GlossaryTooltip>, you need to take additional steps to implement JavaScript Detections:
9+
10+
- Ensure that anything under `/cdn-cgi/challenge-platform/` is allowed. Your CSP should allow scripts served from your origin domain (`script-src self`).
11+
- For `nonce` script tags:
12+
- 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.
13+
14+
- 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.
15+
16+
:::caution[Warning]
17+
18+
JavaScript Detections is not supported with `nonce` set via `<meta>` tags.
19+
:::
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
inputParameters: planType;;enablement
3+
4+
---
5+
6+
For {props.planType} customers, [JavaScript Detections](/cloudflare-challenges/challenge-types/javascript-detections/) is {props.enablement}.

0 commit comments

Comments
 (0)