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
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account and domain.
11
15
12
-
2. Go to **Page Shield** > **Policies**.
16
+
2. Go to **Security** > **Page Shield** > **Policies**.
13
17
14
18
3. Select **Create policy**.
15
19
16
-
4. <aid="rule-form" />
17
-
Enter a descriptive name for the rule in **Description**.
20
+
4. Enter a descriptive name for the rule in **Description**.
18
21
19
22
5. Under **If incoming requests match**, define the policy scope. You can use the Expression Builder (specifying one or more values for **Field**, **Operator**, and **Value**) or manually enter an expression using the Expression Editor. For more information, refer to [Edit expressions in the dashboard](/ruleset-engine/rules-language/expressions/edit-expressions/).
20
23
@@ -33,3 +36,38 @@ description: Learn how to create a Page Shield policy in the Cloudflare dashboar
33
36
-_Log_: Logs any policy violations without blocking any resources not covered by the policy.
34
37
35
38
8. To save and deploy your rule, select **Deploy**. If you are not ready to deploy your rule, select **Save as Draft**.
Enter a descriptive name for the rule in **Description**.
54
+
55
+
5. Under **If incoming requests match**, define the scope of the content security rule (or policy). You can use the Expression Builder (specifying one or more values for **Field**, **Operator**, and **Value**) or manually enter an expression using the Expression Editor. For more information, refer to [Edit expressions in the dashboard](/ruleset-engine/rules-language/expressions/edit-expressions/).
56
+
57
+
6. Under **Allow these directives**, select the desired [CSP directives](/page-shield/policies/csp-directives/) for the content security rule by enabling one or more checkboxes.
58
+
59
+
- To manually enter an allowed source, select **Add source**.
60
+
- To refresh the displayed sources based on detected resources, select **Refresh suggestions**.
61
+
62
+
:::note
63
+
Cloudflare provides suggestions for **Default**, **Scripts**, and **Connections** directives. For the **Default** directive, suggestions are based on monitored scripts and connections resources.
64
+
:::
65
+
66
+
7. Under **Then take action**, select the desired action:
67
+
68
+
-_Allow_: Enforces the CSP directives configured in the content security rule, blocking any other resources from being loaded on your website, and logging any [policy violations](/page-shield/policies/violations/).
69
+
-_Log_: Logs any rule violations without blocking any resources not covered by the content security rule.
70
+
71
+
8. To save and deploy your rule, select **Deploy**. If you are not ready to deploy your rule, select **Save as Draft**.
Copy file name to clipboardExpand all lines: src/content/docs/page-shield/policies/csp-directives.mdx
+10-15Lines changed: 10 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,26 +5,23 @@ sidebar:
5
5
order: 6
6
6
head: []
7
7
description: CSP directives supported by policies
8
-
9
8
---
10
9
11
-
import { GlossaryTooltip } from"~/components"
10
+
import { GlossaryTooltip } from"~/components";
12
11
13
-
Page Shield policies support most <GlossaryTooltipterm="content security policy (CSP)">Content Security Policy (CSP)</GlossaryTooltip> directives, covering both monitored and unmonitored resources. You can use a policy to control other types of resources besides scripts and their connections, even though Page Shield is not monitoring these resources.
12
+
Page Shield policies support most <GlossaryTooltipterm="content security policy (CSP)">Content Security Policy (CSP)</GlossaryTooltip> directives, covering both monitored and unmonitored resources. You can use a policy to control other types of resources besides scripts and their connections, even though Cloudflare is not monitoring these resources.
14
13
15
14
Each CSP directive can contain multiple values, including:
16
15
17
-
* Schemes
18
-
* Hostnames
19
-
* URIs
20
-
* Special keywords between single quotes (for example, `'none'`)
21
-
* Hashes between single quotes (for example, `'sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC'`)
16
+
- Schemes
17
+
- Hostnames
18
+
- URIs
19
+
- Special keywords between single quotes (for example, `'none'`)
20
+
- Hashes between single quotes (for example, `'sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC'`)
22
21
23
22
Hostname and URI values support a `*` wildcard for the leftmost subdomain.
24
23
25
-
The following table lists the supported CSP directives and special values you can use in Page Shield policies:
26
-
27
-
24
+
The following table lists the supported CSP directives and special values you can use in policies:
28
25
29
26
| Directive | Name in the dashboard | Supported special values | Monitored |
Copy file name to clipboardExpand all lines: src/content/docs/page-shield/policies/index.mdx
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,28 +15,30 @@ Only available to Enterprise customers with a paid add-on.
15
15
16
16
Policies define the resources allowed on your applications through <GlossaryTooltipterm="content security policy (CSP)">Content Security Policy (CSP)</GlossaryTooltip> directives. Policies can log violations and also enforce an allowlist of resources, effectively blocking resources not included in the policies.
17
17
18
+
In the [new security dashboard](/security/), policies are called content security rules, and they are one of the available types of [security rules](/security/rules/). Security rules perform security-related actions on incoming requests that match specified filters.
19
+
18
20
Create [allow policies](#policy-actions) to define a positive security model, also known as positive blocking. According to this model, you define what is allowed and reject everything else. Such an approach helps you reduce the attack surface for unwanted third-party scripts in your application.
19
21
20
-
A policy can control both resources monitored by Page Shield, such as scripts and their connections, and other types of resources. Refer to [Supported CSP directives](/page-shield/policies/csp-directives/) for details.
22
+
A policy can control both client-side resources monitored by Cloudflare, such as scripts and their connections, and other types of resources. Refer to [Supported CSP directives](/page-shield/policies/csp-directives/) for details.
23
+
24
+
### Important remarks
21
25
22
-
:::note
23
26
Third-party service providers may require specific CSP directives. Refer to your provider's documentation for more information on the CSP directives you need to include in your policy.
24
-
:::
25
27
26
28
## Policy actions
27
29
28
-
A policy can perform one of the following actions:
30
+
A policy — or content security rule — can perform one of the following actions:
29
31
30
-
-**Log**: Page Shield will log any resources not covered by the policy, without blocking any resources. Use this action to validate a new policy before deploying it. Resources not covered by the policy will be reported as [policy violations](/page-shield/policies/violations/).
31
-
-**Allow**: Page Shield will block any resources not explicitly allowed by the policy. Switch to the _Allow_ action after validating a new policy with the _Log_ action, so that your policy does not block essential application resources, which would affect your application's end users. Policies with the _Allow_ action will log [policy violations](/page-shield/policies/violations/) for any blocked resources.
32
+
-**Log**: Cloudflare will log any resources not covered by the policy, without blocking any resources. Use this action to validate a new policy before deploying it. Resources not covered by the policy will be reported as [policy violations](/page-shield/policies/violations/).
33
+
-**Allow**: Cloudflare will block any resources not explicitly allowed by the policy. Switch to the _Allow_ action after validating a new policy with the _Log_ action, so that your policy does not block essential application resources, which would affect your application's end users. Policies with the _Allow_ action will log [policy violations](/page-shield/policies/violations/) for any blocked resources.
32
34
33
-
For details on the CSP directives Page Shield creates for each type of policy action, refer to [How Page Shield works](/page-shield/how-it-works/#positive-security-model-using-policies). For more information on the CSP directives supported by Page Shield policies, refer to [Supported CSP directives](/page-shield/policies/csp-directives/).
35
+
For details on the CSP directives Cloudflare creates for each type of policy action, refer to [How Page Shield works](/page-shield/how-it-works/#positive-security-model-using-policies). For more information on the CSP directives supported by policies, refer to [Supported CSP directives](/page-shield/policies/csp-directives/).
34
36
35
37
## Next steps
36
38
37
-
Refer to the following pages for instructions on creating a policy in Page Shield:
39
+
Refer to the following pages for instructions on creating a policy or content security rule:
38
40
39
41
-[Create a policy in the dashboard](/page-shield/policies/create-dashboard/)
40
42
-[Page Shield API: Create a policy](/page-shield/reference/page-shield-api/#create-a-policy)
41
43
42
-
Once you have configured one or more allow policies in a zone you can filter alert notifications according to those policies. These alerts are called [scoped alerts](/page-shield/alerts/#scoped-alerts).
44
+
Once you have configured one or more allow policies in a zone, you can filter alert notifications according to those policies. These alerts are called [scoped alerts](/page-shield/alerts/#scoped-alerts).
Only available to Enterprise customers with a paid add-on.
14
14
:::
15
15
16
-
Shortly after you configure Page Shield policies, the Cloudflare dashboard will start displaying any violations of those policies. This information will be available for policies with any [action](/page-shield/policies/#policy-actions) (_Allow_ and _Log_).
16
+
Shortly after you configure policies (or content security rules), the Cloudflare dashboard will start displaying any violations of those policies. This information will be available for policies with any [action](/page-shield/policies/#policy-actions) (_Allow_ and _Log_).
17
17
18
18
Information about policy violations is also available via [GraphQL API](/analytics/graphql-api/) and [Logpush](/logs/about/).
19
19
20
20
## Review policy violations in the dashboard
21
21
22
-
The policy violation information is available in **Security** > **Page Shield** > **Policies**. It includes the following:
22
+
To view policy violation information:
23
23
24
-
- A sparkline next to the policy name, showing policy violations in the past seven days.
25
-
- For policies with associated violations, an expandable details section for each policy, with the top resources present in policy violation events and a sparkline per top resource.
24
+
- Old dashboard: Go to **Security** > **Page Shield** > **Policies**.
25
+
- New dashboard: Go to **Security** > **Security rules**, and filter by **Content security rules**.
26
+
27
+
The displayed information includes the following:
28
+
29
+
- A sparkline next to the policy/rule name, showing violations in the past seven days.
30
+
- For policies with associated violations, an expandable details section for each policy, with the top resources present in violation events and a sparkline per top resource.
[Cloudflare Logpush](/logs/about/) supports pushing logs to storage services, <GlossaryTooltipterm="SIEM">SIEM systems</GlossaryTooltip>, and log management providers.
127
132
128
-
Information about Page Shield policy violations is available in the [`page_shield_events` dataset](/logs/reference/log-fields/zone/page_shield_events/).
133
+
Information about policy violations is available in the [`page_shield_events` dataset](/logs/reference/log-fields/zone/page_shield_events/).
129
134
130
135
For more information on configuring Logpush jobs, refer to [Logs: Get started](/logs/get-started/).
0 commit comments