Skip to main content

Using Policy Builder

You will learn how to use Policy Builder in this section.

Through Policy Builder, you can:

  • Enable Policy Builder
  • Add a Rule
  • Modify a Rule
  • Preview a Policy

Enabling Policy Builder

The following section describes how to enable the Policy Builder feature. The instructions assume that have already created an Entitlements System.

  1. Log in to the Styra DAS UI.
  2. In System, select your Entitlements System.
  3. Expand the Entitlements System.
  4. Select Policy > rules.rego.
  5. Enable the Policy Builder by clicking the User icon > Feature preview > Policy Builder.
  6. Click Enable.
  7. Close Feature Preview.
  8. Click the Builder icon in the authoring toolbar.

The Policy Builder is enabled.

Adding a Rule

The following section describes how to add a Rule in Policy Builder.

  1. In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
  2. Click Add rule in the authoring toolbar.
  3. Select one of the available rules.
  4. The new rule is added to the top of the Policy Builder.
  5. In the toolbar, click Publish to apply the changes to your policy.

The new rule is added.

Modifying a Rule

The following section describes how to modify a Rule in Policy Builder.

Adding Conditions

The following steps are used to add a condition.

  1. In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
  2. Add a rule to your policy, or use an existing rule.
  3. Select the rule where you will add a condition and the click the Plus icon (Add condition to rule).
  4. Click Add condition.
  5. In Filter, select a rule. The Add condition panel appears.
  6. In the Add condition panel, set your parameters.
  7. Click Save to finalize adding the condition to your rule.
  8. Click Publish in the toolbar to apply the changes to your policy.

Conditions are applied to your rule.

Modifying Condition Parameters

The following steps are used to modify condition parameters.

  1. In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
  2. Hover over the condition to modify, and click the Pen icon to the right of the condition.
  3. The Edit condition panel appears.
  4. Modify the condition parameters.
  5. Click Save to confirm the changes.
  6. Click Publish in the toolbar to apply the changes to your policy.

The conditions of the rule are modified.

Removing Conditions

The following steps are used to remove conditions.

  1. In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
  2. Hover over the condition to remove it, and click the Trash icon to the right of the condition.
  3. A confirmation dialog box appears.
  4. Click Delete condition.
  5. Click Publish in the toolbar to apply the changes to your policy.

The condition is removed.

Previewing a Policy

The following section describes how to preview a Policy in Policy Builder. This lets you confirm that the Policy returns the expected results, given a specific input document.

  1. In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
  2. In the toolbar, click the Preview icon.
  3. Toggle Coverage to on and Exclude Stacks to off.
  4. Click Preview to open the Input and Output panels.
  5. In the Input panel, add an input document for the request to test.
  6. Click Preview again to test your policy with the input document.
  7. The results are displayed in Output. Any Rule that was fully evaluated shows a tag representing the decision of that Rule.
  8. To the right of the Rule cards, the decision of the Policy as a whole is presented in the Outcome section.