Set policy based on approval status
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.
-
In Zero Trust ↗, go to Gateway > Firewall policies.
-
In the HTTP tab, select Add a policy.
-
Name the policy.
-
Under Traffic, build a logical expression that defines the traffic you want to allow for AI at your organization.
Selector Operator Value Application in Artificial Intelligence -
For Action, select Allow.
-
Select Create policy.
For more information, refer to Block unauthorized applications.
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.
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.
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.
-
In Zero Trust ↗, go to Gateway > Firewall policies.
-
In the HTTP tab, select Add a policy.
-
Name the policy.
-
Under Traffic, build a logical expression that defines the traffic you want to allow for AI at your organization.
Selector Operator Value Application in Artificial Intelligence -
For Action, select Block.
-
To Modify the Gateway block behavior, determine how you want to redirect your users.
- Redirect users to a custom block page to coach the user:
- Select Use account-level block setting.
- Check Add an additional message to your custom block page when traffic matches this policy and enter your custom message.
- Redirect users to an approved AI tool automatically:
- Select Override account setting with URL redirect.
- Enter the URL to the approved application you want to redirect the user to use instead.
- Redirect users to a custom block page to coach the user:
-
Select Create policy.
For more information, refer to Configure policy block behavior.
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.
-
In Zero Trust ↗, go to Gateway > Firewall policies.
-
In the HTTP tab, select Add a policy.
-
Name the policy.
-
Under Traffic, build a logical expression that defines the traffic you want to allow for AI at your organization.
Selector Operator Value Application in Artificial Intelligence -
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.
Selector Operator API Value Application in any(identity.groups.name[*] in {\"contractors\" \"cohort-224\"})
-
For Action, select Allow.
-
Select Create policy.
In most scenarios, Gateway evaluates HTTP policies in top-down order. Therefore, you can capture prompts in specific scenarios to gain visibility without disrupting your users' work, all while holistically protecting against sensitive data loss.
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.
-
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.
Operator Selector Operator Value Action Application in Artificial Intelligence And DLP Profile in my-sensitive-data Block -
Next, create the policy that allows the use of AI and specifies the prompt capture for specific user groups.
Selector Operator Value Application in Artificial Intelligence -
Under Traffic:
Selector Operator Value Application in Artificial Intelligence -
Under Identity:
Selector Operator API Value Action User Group Names in any(identity.groups.name[*] in {\"contractors\" \"cohort-224\"})
Allow
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.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark
-