|
| 1 | +--- |
| 2 | +title: Set policy based on approval status |
| 3 | +pcx_content_type: overview |
| 4 | +sidebar: |
| 5 | + label: Set policy based on approval status |
| 6 | + order: 1 |
| 7 | +--- |
| 8 | + |
| 9 | +If you use specific AI tools within your organization, you may want to create policies to explicitly allow the usage of those tools while continuing to evaluate additional usage within your organization. |
| 10 | + |
| 11 | +## Create a Gateway policy for monitoring and evaluating all AI tool usage |
| 12 | + |
| 13 | +1. In [**Zero Trust**](https://one.dash.cloudflare.com/), go to **Gateway** > **Firewall policies**. |
| 14 | +2. In the **HTTP** tab, select **Add a policy**. |
| 15 | +3. Name the policy. |
| 16 | +4. Under **Traffic**, build a logical expression that defines the traffic you want to allow for AI at your organization. |
| 17 | + |
| 18 | + | Selector | Operator | Value | |
| 19 | + | -------- | -------- | ----- | |
| 20 | + | Application | in | *Artificial Intelligence* | |
| 21 | + |
| 22 | +5. For **Action**, select **Allow**. |
| 23 | +6. Select **Create policy**. |
| 24 | + |
| 25 | +For more information, refer to [Block unauthorized applications](/cloudflare-one/policies/gateway/http-policies/common-policies/#block-unauthorized-applications). |
| 26 | + |
| 27 | +## Create a Gateway policy to redirect users towards approved AI tools |
| 28 | + |
| 29 | +Conversely, you can build policies that take specific actions based on an AI tool's approval status. For example, if you want to redirect users from unapproved applications to approved applications, you can create custom status pages to provide user coaching. |
| 30 | + |
| 31 | +User coaching is a valuable tool for encouraging employees to change their behavior. By redirecting users to a status page, you can help them understand the risks of using unsanctioned AI tools and educate them on the dangers of inputting sensitive data. |
| 32 | + |
| 33 | +Cloudflare Workers are an easy method to stand up custom user coaching pages. The customs status pages can be handled dynamically based on the information that Gateway sends about a blocked request. In the appendix of this document, you can find sample code for a Cloudflare Worker built for this purpose that you can test and adopt if desired. |
| 34 | + |
| 35 | +## Redirect users towards approved AI tools |
| 36 | + |
| 37 | +1. In [**Zero Trust**](https://one.dash.cloudflare.com/), go to **Gateway** > **Firewall policies**. |
| 38 | +2. In the **HTTP** tab, select **Add a policy**. |
| 39 | +3. Name the policy. |
| 40 | +4. Under **Traffic**, build a logical expression that defines the traffic you want to allow for AI at your organization. |
| 41 | + |
| 42 | + | Selector | Operator | Value | |
| 43 | + | -------- | -------- | ----- | |
| 44 | + | Application | in | *Artificial Intelligence* | |
| 45 | + |
| 46 | +5. For **Action**, select **Block**. |
| 47 | +6. To **Modify the Gateway block behavior**, determine how you want to redirect your users. |
| 48 | + - Redirect users to a custom block page to coach the user: |
| 49 | + 1. Select **Use account-level block setting**. |
| 50 | + 2. Check **Add an additional message to your custom block page when traffic matches** this policy and enter your custom message. |
| 51 | + - Redirect users to an approved AI tool automatically: |
| 52 | + 1. Select **Override account setting with URL redirect**. |
| 53 | + 2. Enter the URL to the approved application you want to redirect the user to use instead. |
| 54 | +7. Select **Create policy**. |
| 55 | + |
| 56 | +For more information, refer to [Configure policy block behavior](/cloudflare-one/policies/gateway/block-page/#configure-policy-block-behavior). |
| 57 | + |
| 58 | +## Capture prompts to prevent data loss |
| 59 | + |
| 60 | +You can build policies that enable Prompt Capture for AI applications in specific, complex scenarios. This gives you the flexibility to apply advanced functionality to certain applications, tool types, or user groups, such as contractors or new employees, especially if they pose a higher risk for using unsanctioned applications due to lack of awareness or training. |
| 61 | + |
| 62 | +1. In [**Zero Trust**](https://one.dash.cloudflare.com/), go to **Gateway** > **Firewall policies**. |
| 63 | +2. In the **HTTP** tab, select **Add a policy**. |
| 64 | +3. Name the policy. |
| 65 | +4. Under **Traffic**, build a logical expression that defines the traffic you want to allow for AI at your organization. |
| 66 | + |
| 67 | + | Selector | Operator | Value | |
| 68 | + | -------- | -------- | ----- | |
| 69 | + | Application | in | *Artificial Intelligence* | |
| 70 | + |
| 71 | +5. Under **Identity**, build a logical express that defines the user identity you want to capture and log their prompts to review for data loss prevention. |
| 72 | + |
| 73 | + | Selector | Operator | API Value | |
| 74 | + | -------- | -------- | ----- | |
| 75 | + | Application | in | `any(identity.groups.name[*] in {\"contractors\" \"cohort-224\"})`| |
| 76 | + |
| 77 | +6. For **Action**, select **Allow**. |
| 78 | +7. Select **Create policy**. |
| 79 | + |
| 80 | +## Order your policies for specific inspection and enforcement |
| 81 | + |
| 82 | +In most scenarios, Gateway evaluates HTTP policies in [top-down order](/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/). |
| 83 | +Therefore, you can capture prompts in specific scenarios to gain visibility without disrupting your users' work, all while holistically protecting against sensitive data loss. |
| 84 | + |
| 85 | +For example, if you want to prevent sensitive data being shared with AI but want to allow all users to use AI but capture the prompts for specific identity-defined user groups, you would need to order your policies in the following way. |
| 86 | + |
| 87 | +1. The policy that blocks sensitive data being shared would need to be ordered first in this policy group. This will allow it to be enforced before the next policy in the policy group. |
| 88 | + |
| 89 | + | Operator | Selector | Operator | Value | Action | |
| 90 | + | -------- | -------- | -------- | ----- | ------ | |
| 91 | + | | Application | in | *Artificial Intelligence* | | |
| 92 | + | And | DLP Profile | in | *my-sensitive-data* | Block | |
| 93 | + |
| 94 | +2. Next, create the policy that allows the use of AI and specifies the prompt capture for specific user groups. |
| 95 | + |
| 96 | + | Selector | Operator | Value | |
| 97 | + | -------- | -------- | ----- | |
| 98 | + | Application | in | *Artificial Intelligence*| |
| 99 | + |
| 100 | +3. Under **Traffic**: |
| 101 | + |
| 102 | + | Selector | Operator | Value| |
| 103 | + | -------- | -------- | ------ | |
| 104 | + | Application | in | *Artificial Intelligence*| |
| 105 | + |
| 106 | +4. Under **Identity**: |
| 107 | + |
| 108 | + | Selector | Operator| API Value | Action | |
| 109 | + | -------- | -------- | -------- | ------ | |
| 110 | + | User Group Names | in | `any(identity.groups.name[*] in {\"contractors\" \"cohort-224\"})`| Allow | |
| 111 | + |
| 112 | +By structuring your policies in this way, you ensure that any instance of sensitive data is blocked from AI applications, no matter which user group is involved. If Cloudflare does not detect sensitive data, it will allow the prompt while capturing it for the targeted user groups–in this case, users belonging to the `contractors` and `cohort-224` groups. If that same user group were to then use sensitive data in a prompt, it would be detected and blocked. |
0 commit comments