Cloud Policies: Custom
This is a how-to guide for creating custom cloud policies.
- To manage policies, see Cloud Policies.
- To view and manage cloud findings, see Cloud Findings.
- To learn about finding statuses and the finding lifecycle, see Finding Lifecycle.
- To learn about how finding severity works, see Finding Severity.
Create custom policies to address specific issues relevant to your organization. Custom policies can be based on:
Custom policies created on the organization level or within a group of accounts (folder) are inherited to all children accounts, including to any children accounts created at a later time. You can only enable or disable a custom policy from the original folder/account that you created it from. For example, if you created a custom policy from the top-level AWS folder, you won’t be able to enable/disable it from any children folders/accounts within the AWS folder. In this case, the status you define in the top-level AWS folder is propagated to all children folders/accounts. See Account Hierarchy and Folders for more information about folders.
If you created an automation rule and chose to apply it to All policies, any automation targets (actions) that you selected will also apply to custom policies that you create.
Add a Custom Policy
To add a custom policy:
- (Optional) Select an account scope in the Organization dropdown to limit the scope of the custom policy to a specific subset of cloud accounts. By default, the entire organization (all accounts) is selected.
- In the left navigation pane, click Policies > Cloud Policies.
- Select the Custom tab.
- Click + Create Custom Policy. The Create Custom Policy wizard opens.
-
Select the policy type.

Query
Convert an Explorer query into a custom policy. For example, create a policy for tracking publicly exposed EC2 instances with sensitive tags. To use a query, either choose an existing query by clicking Select query, or build one from scratch.
- Linked queries cannot be deleted, made private, or edited with unsupported syntax.
- If you selected an existing query and want to edit it, open the three-dot menu and click Unlink to modify the filters. The policy will no longer be synced with the original query.

Template
Easy-to-use templates to address specific issues relevant to your organization.
- Select the template that you want to use for this policy and then click Select.
-
Depending on the template you chose, you will need to select the conditions that define when the policy applies. For example, if you chose Monitor Permissions > These principals should not have these permissions on these resources, you will need to select the principals, permissions (either specific actions, or broad categories), and resources that the policy applies to. For any given condition, you can select one or more entities.
Explorer-based templates: Some templates use the Explorer query editor instead of individual parameter pickers. For these templates, a pre-built query appears in the right panel. You can refine the query using the Explorer query editor. For more information, see Explorer. -
Click the Preview button before you create the policy to see the counts of matching Principals and Resources. Click a count to view the specific entities that match.
Logical operators for multiple selection
- Tags/labels — If you select multiple tags or labels (for example, in Resource with these tags), an ALL logical operator is applied, meaning that the policy is only triggered if all specified tags or labels are identified. To apply ANY logic to tags/labels in this context, you can create multiple custom policies, each configured with the specific tag/label that you want as your trigger.
- All other conditions — If you select multiple entities/resources, an ANY logical operator is applied, meaning that the policy is triggered if any of the specified resources are identified.
-
For the following templates, you can choose whether to apply either the ALL or ANY operators. Also, you can define exclusions for these templates.
- Only these principals should have these permissions on these resources
- These principals should not have these permissions on these resources
- These principals should not have these roles on these resources

Rego
Write your custom policy in standard Rego v2 syntax.
- Select a resource type the policy will evaluate.
- Author a new policy, or click Import Rego from existing policy to search for and select a built-in policy.
- To test run the code, click Single or Batch in the Test Data section to select one or more existing resources, and then click Run in the Output section.
- Enter a meaningful name and an optional description.
- Assign the policy a severity, which determines the severity level of any findings triggered by the policy.
- (Optional) Enter custom remediation steps to provide clear guidance for security teams.
- When finished, click Create.
Custom Rego Policies
Custom Rego policies use Rego, the Open Policy Agent (OPA) policy language, to write attribute-level checks against a single resource. They sit between templates, which cover common checks through predefined parameters, and Explorer queries, which provide an easier way to visualize resources.
Use Rego when any of the following apply:
- You already have Rego expertise and prefer it to templates or graph queries.
- You need conditions that go beyond what templates and graph queries support.
- You have an existing policy written in Rego and want to reuse it in Tenable One Cloud Exposure.
If cross-resource logic is required, use an Explorer query instead.
Speed up custom policy development by starting from an existing policy written in Rego, whether built-in or custom. You can also use this approach to tune a built-in policy to your needs: copy the built-in policy, adjust the logic in your copy, and disable the original.
Once created, a Rego-based policy behaves like any other custom policy. Its findings follow the same format, dashboards, reports, automation, ticketing, exclusions, and compliance frameworks, and it uses the same role-based access controls. See Cloud Findings for more information.
Policy Evaluation
Each Rego-based custom policy evaluates one resource at a time. The policy receives the resource as input in raw provider JSON format. A policy cannot retrieve, traverse, or reference other resources during evaluation. Every evaluation ends in exactly one state:
| State | Meaning |
|---|---|
| Skipped | The resource matches the policy's type but falls outside its entry criteria. |
| Passed | The resource passes the policy evaluation. |
| Failed | The resource fails the policy evaluation, and a finding is produced. |
| Error | The evaluation did not complete due to a runtime error (e.g., invalid resource JSON, logic returns both passed and failed). This state is assigned by the engine. |
Helper Functions
A helper function is a small, pre-built piece of logic you call from a custom Rego policy instead of writing it yourself. Checking whether a value is null, empty, or differs from another only by capitalization normally takes several lines of Rego; a helper function wraps that check into a single call.
Cloud Exposure authors and audits every allowlisted helper function for side-effect-free behavior: no network, file, or host access. The allowlist is re-validated with each OPA update, so a new helper function becomes available only after that review.
To use a helper function, click Helper Functions above the Rego editor and copy the function into your policy.
The following table lists each allowlisted helper function and its behavior.
| Helper Function | Behavior |
|---|---|
| equals_ignore_case(value_1, value_2) | Determines whether value_1 and value_2 are equal, ignoring the case. Returns true when they match regardless of capitalization, otherwise it is false. |
| get_days_ns(days) | Returns the given number of days as a nanosecond duration. |
| is_false(value) | Determines whether the value represented is false. Returns true when its string form equals "false" (case-insensitive), otherwise it is false. |
| is_true(value) | Determines whether the value represented is true. Returns true when its string form equals "true" (case-insensitive), otherwise it is false. |
| is_null_or_empty(value) | Determines whether the value is missing or empty. Returns true when it's null, an empty string, an empty array, or an empty object. Otherwise it is false. |
Custom Policy Templates
Cloud Exposure provides a number of templates that you can use to create custom policies. These templates provide a flexible way of defining exactly which resources you want to monitor, and how. For example, you can use the Monitor any activity of these identities template to create a custom policy that monitors activity in a break glass account (used for emergency purposes) to ensure that it’s not being used by unauthorized identities. Or, for example, you can use templates that monitor changes in buckets/keys/secrets to monitor critical, “crown jewel” assets in your environment.
The following templates, divided by category, can be used to create custom policies that address specific use cases:
| Category | Cloud | Template | Potential Use Case |
|---|---|---|---|
| Monitor Permissions | AWS | Only these principals should have these permissions | Protecting crown jewel data. Prevent specific identities from accessing sensitive resources. |
| AWS | For these resources, only these principals should have these permissions | Segregation of duties. Only specific identities should have access to this resource(s). | |
| Azure | Only these principals should have these permissions on these resources | Segregation of duties. Only specific identities should have access to this resource(s). | |
| AWS/Azure/GCP | These principals should not have these permissions on these resources | Protecting crown jewel data. Prevent specific identities from accessing sensitive resources. | |
| Azure/GCP | These principals should not have these roles on these resources | Impersonation. Monitor changes in access to sensitive roles. | |
| AWS | These roles should have policies that match this reference role Note: If you use organizational roles, and want per-account instances of the roles to conform to a pre-defined template, you can use this template to alert when the set of attached policies deviates from the chosen reference role. |
||
| AWS | Monitor policy, ACL, and Block Public Access setting changes in these buckets | Protecting crown jewel data. Get alerts on changes to sensitive bucket configuration. | |
| AWS | Monitor permission changes in these keys | Protecting crown jewel data. Get alerts on changes to key policies. | |
| AWS | Monitor policy changes in these secrets | Protecting crown jewel data. Get alerts on changes to specific secret policies. | |
| AWS | Monitor changes on identity-based policies attached to these principals | IMonitor policy changes on high-impact principals to prevent privilege escalation. | |
| AWS | Monitor trust policy changes in these roles | Impersonation. Monitor changes in access to sensitive roles. | |
| Monitor Activity | AWS/Azure/GCP |
Monitor any activity of these identities Important Notes:
|
Monitor break glass accounts. Monitor identity activity for use of break glass accounts. |
| Monitor Sensitive Data | AWS/Azure | This sensitive data should not reside in these resources | Detects sensitive data that is stored within restricted boundaries where it should not reside. Use to monitor data sprawl and enforce data boundary compliance. Learn more. |
| Monitor Resources | AWS | Monitor rule changes in these security groups | Network security. Monitor changes to sensitive security groups. |
| AWS | Monitor policy, ACL, and Block Public Access setting changes in these buckets | Protecting crown jewel data. Get alerts on changes to sensitive bucket configuration. | |
| AWS | Monitor permission changes in these keys | Protecting crown jewel data. Get alerts on changes to key policies. | |
| AWS | Monitor policy changes in these secrets | Protecting crown jewel data. Get alerts on changes to specific secret policies. | |
| AWS | Monitor these IAM principals of these types that are created | Monitoring access. Monitor newly created identities. | |
| AWS | Monitor trust policy changes in these roles | Impersonation. Monitor changes in access to sensitive roles. | |
| AWS | Monitor when these permission sets are assigned to users or groups | Monitoring access. Monitor AWS Identity Center permission set changes. | |
| AWS | Monitor when these permission sets are created or updated | Monitoring access. Monitor AWS Identity Center permission set changes. | |
| AWS | Monitor rule changes in these security groups | Network security. Monitor changes to sensitive security groups. | |
| AWS/Azure/GCP |
Resources should not allow inbound internet connection from these IPv4 address ranges to these ports Note: This policy applies to the following resources:
|
Network security. Limit access from external networks. | |
| AWS | These security groups should not allow inbound internet access from these IP address ranges to these ports. | Network security. Limit access from internal or external networks. | |
| AWS | These security groups should allow inbound internet access from these IP address ranges to these ports. | Network security. Limit access from internal or external networks. |
For a worked example of building a custom data type and a custom sensitive data policy, see Governing Proprietary Sensitive Data.
