Skip to content

Policies

A policy is one rule that your infrastructure must follow, such as “S3 buckets must be private”. Nimzo checks your stacks against policies in pull requests and in audits. Policies come from two sources. Nimzo supplies Vendor policies. Your organization writes Custom policies.

The Policies page lists every policy your organization can run. To group policies and choose where they apply, use bundles.

The Policies page, with the ID, severity and provider of each policy

  1. In the sidebar, select Policies.
  2. Type in Search policies to find a policy by its name or its ID.
  3. Select Filters, the filter icon after the search field, then pick a Provider, a Category or an Origin. You can pick several values of each. Origin is Vendor for the policies that Nimzo supplies, or Custom for the policies of your organization. The filters in use show in a bar under the search field. In the bar, change is any of to is not to leave the values out. To remove all filters, select Clear filters in the menu, or Clear in the bar.
  4. To sort the list, select the head of a column. You can sort by Policy, ID, Severity, Provider and Updated.

The list loads more rows as you scroll. The footer shows how many policies match, for example “Showing 25 of 40 policies”.

If no policy matches, the page says No policies match these filters. Select Clear filters to start again. The search and the filters stay off while your organization has no policy.

Select a row in the list. The policy page has four tabs:

  • Overview shows what the policy checks and how to fix it. It also shows the run history: every pull request check and audit that evaluated the policy, with the version each one used. The column on the right lists the properties of the policy:
    • Status is Enabled when a bundle that holds the policy is enabled. Otherwise it is Disabled.
    • Severity, Version, Source, Provider (with its logo and full name), Service, Category, Package and Labels.
    • Parameters, Compliance, References, Bundles and Versions.
  • Rego shows the code of the policy and its test.
  • Examples shows the Fails example and the Passes example. The fail example must give at least one finding. The pass example must give none.
  • Versions shows every version and the draft, if the policy has one.

To change the values of the policy parameters for your organization, select the pencil button on the Parameters card.

A Nimzo policy on its Overview tab, with its properties on the right

  1. On the Policies page, select Create policies.
  2. Choose how to create the policy:
    • Describe it: you write what you want to govern, and Nimzo drafts the policies.
    • Write Rego: you write the policy as code.

Your organization needs a policy ID prefix to create or fork policies. Set it in Settings before authoring, or enter it when prompted during a retry, fork, or manual save. In Policy prefix, type 2 to 10 uppercase letters or digits, starting with a letter, such as ACME. Policy IDs then look like ACME_S3_001. Select Save prefix. Only an Admin can save the prefix.

  1. In Policy brief, describe what must be true, where, and any exceptions.

  2. Optional: add context files under Add files (optional), or select reference bundles and policies as examples. References do not impose requirements on the new policies.

    The Describe it tab with a policy brief

  3. Select Find policies. The Policy proposals page shows the proposals for this brief, and Nimzo starts preparing them; generation does not start yet. Select a proposal to review its description, target policy when applicable, and Evidence. Use Show more to read a full item and Show less to collapse it.

  4. Optional: answer a proposal’s questions or add guidance. Questions you leave unanswered use their defaults. Select the proposals you want, or use Select all to select eligible proposals in the current view, and select Generate.

  5. Follow the results on Policy generation. Policies that are still being prepared continue there on their own. If a policy would build on an existing draft and change it, select Override existing draft, check the current draft, then select Confirm draft override; other policies continue while one waits. If preparing a policy fails, select Retry. All policies you generate together appear on one page, with shared progress, selection and actions.

  6. Review each saved draft with Open policy draft, which opens the draft editor over the generation page. Drafts remain unpublished until you publish them. A published result offers View policy instead. Evidence, Details and Confidence bars are separate from severity: fuller bars indicate a stronger categorical assessment, while empty bars mean unassessed or unavailable. Assessments do not replace the underlying evidence or prevent saving.

  7. Select saved policies individually or with Select all, then select Publish and choose Publish only, Publish and create bundle or Publish and add to existing bundle. Select Revert to restore an unpublished result’s previous state. Published results cannot be reverted; if restoration is not confirmed, select Retry revert.

Select View proposals on the Policies page to see the general proposal list. Discovery links reopen the proposals for that brief, and existing work can be reopened to follow its progress.

To remove proposals you do not need, select them and select Dismiss, then confirm. Their evidence, policies and drafts are kept. Proposals that are being prepared or have generation requested cannot be dismissed. To restore them, select Undo in the confirmation message within 10 seconds, before you leave the proposals page.

Keep the generation page active while drafts save. After a long absence, return and retry unfinished policies.

Select Cancel generation to stop unfinished work; saved drafts remain available. For failed or interrupted policies, use Retry. If saving a new policy was not confirmed, a retry may recreate a policy that was deleted.

Discover from stacks or repository activity

Section titled “Discover from stacks or repository activity”

Nimzo can also find proposals in the code of your stacks, or in a repository’s pull requests, issues and discussions. Start from Discover from stacks or Discover from repository activity on the Policy proposals page.

Discover from stacks lists the stacks imported from a connected repository, with their discovery status, their proposals, and when they were last discovered at which commit. Libraries are not listed: their rules are found through the stacks that use them.

  1. Select the stacks, then select Discover N stacks. Nimzo reads each stack’s repository on its default branch.
  2. Follow each stack’s status: Discovering, then Discovered with the commit it read. Discovering a stack whose commit has not changed since the last successful discovery finishes quickly without analyzing it again. Select Cancel to stop a stack, or Retry when it failed. You can discover a stack again at any time.
  3. Select View next to a stack’s proposals to open them on Policy proposals, then continue from step 4 of Describe it.

Discover from repository activity lists the pull requests, issues and discussions Nimzo can read, with their type, repository, state and discovery status. A pull request is Open, Merged or Closed; an issue is Open, Closed or Closed (not planned); a discussion is Open or Answered.

  1. Select Discover repository activity. Nimzo reads each item with its reviews, comments and answers. An item that changed since it was discovered is read again; an unchanged one is skipped.
  2. Select Retry failed to discover again the items that failed or did not finish.
  3. Select View next to an item’s proposals to open them on Policy proposals.

Discovery runs only while you keep its page open. When you leave, it pauses, and it resumes when you open the page again; the page says so while anything is discovering.

In a proposal’s Evidence, repository evidence names the stack when it comes from one, the repository, the file and lines or the pull request, issue or discussion, and the commit, with a link to the source. Its label says how it relates to the requirement: Observed convention or Organizational rule for code, and Proposed idea, Rejected idea or Accepted requirement for repository activity.

You can also start this flow in Conversations. Approve the requested action in chat, then use its operation link to follow the results.

  1. Select Write Rego.
  2. In policy.rego, write the policy. The first line must be a package line. In policy_test.rego, write its test. Both are required.
  3. In Pass example and Fail example, paste the Terraform that the policy runs against.
  4. In Policy details, fill in Title, Description and Severity. All three are required.
  5. Optional: in Additional details, set Service, Category, Platform, Labels, Remediation and References. The service goes into the policy ID.
  6. Select Validate policy. Nimzo checks the Rego and says The Rego is valid. when it compiles.
  7. Select Save policy.

Nimzo only saves the policy when the Rego compiles. To keep unfinished work, select Save draft. A draft is not validated. See Publish or discard a draft.

After you write Rego, the new policy opens on its own page, with the message Policy created. A draft opens with Draft saved. A new policy does not run until you add it to an enabled bundle. See bundles.

You can edit Custom policies. A Vendor policy has no edit button: fork it first.

  1. Open the policy.
  2. Select the pencil button (Edit policy). On the Rego and Examples tabs, you can also select Edit.
  3. If the policy has a draft, Nimzo says A draft is in progress. Select Edit draft to continue the draft. Select Discard draft to drop it and edit the current version.
  4. Change what you need in the three tabs of the dialog:
    • Overview has Name, Severity, Description, Remediation, Category, Labels, References, Compliance and Change summary. A reference is a title and a link that starts with https://. For Compliance, select Add framework, pick the framework, then pick its controls in the list next to it. The list groups the controls by category, and you can type to search it.
    • Rego has the policy and its test.
    • Examples has the Fails and Passes examples. Select Run test to test the current Rego against an example.
  5. Optional: in Change summary, say what you changed. The field takes up to 500 characters. If you leave it empty, Nimzo lists the changes for you, for example Severity changed, Rego changed. The summary names the version in the Versions tab.
  6. Select Save as v2 (the number is the next version). This creates a new version and opens it. Nimzo checks the Rego first.

To keep your work without making a version, select Save draft instead. When you edit a draft, the buttons are Update draft and Create version. A tab marked (has errors) needs a fix before you can save.

The Edit policy dialog on its Overview tab, while you edit a draft

If you close the dialog with unsaved changes, Nimzo asks Discard changes? Select Keep editing to go back.

A policy has at most one draft. Saving a draft again replaces it. A draft keeps its change summary, and the version it becomes takes it.

The first version of a policy is named Created, or Forked from and the name of the original for a fork. Change summary only shows once the policy has a version.

A draft is a saved copy of your changes. Nimzo does not analyze a draft, and a draft is not a version. The policy keeps running its current version until you publish.

  1. Open the policy and select the Versions tab.
  2. Select the Draft badge at the top of the list of versions. The page shows who saved the draft and when. It also lists the fields that changed, each with a Before and an After value, and the Rego of the draft.
  3. To publish, select Publish. The draft becomes the next version, and Nimzo says Draft published as v3 (with the new number). The version takes the change summary of the draft, or, without one, the list of what changed.
  4. To keep working on it, select Edit draft.
  5. To drop the draft, select Edit draft, then Discard draft, then Discard draft again to confirm.

Nimzo checks the Rego when you publish. Discarding removes the draft and its changes. The current version stays as it is. You cannot discard the draft of a policy that has no version yet.

The Versions tab of a policy, with the draft selected and its new description

The pencil button on a policy carries a yellow dot while the policy has a draft.

A fork is your own editable copy of a policy. It gets your own policy ID. It stops following the updates of the original.

  1. Open the policy.
  2. Select the fork button (Fork policy) at the top right.
  3. If your organization has no policy ID prefix, set one first. See Create policies.

Nimzo says Policy forked and opens the copy. A copy is identical to the original until you edit it. Until then, the copy shows Forked from a vendor policy, not edited yet. You cannot fork it again.

To go back to the original, select Use the Nimzo version on the banner, then select Use the Nimzo version again. Nimzo deletes the copy and opens the original. For a copy of a Custom policy, the button reads Use and the ID of the original, followed by instead.

If copies are waiting for an edit, the Policies page shows Alerts and info. Select it, then select Edit forks.

Once you have edited a copy, you can see how it differs from the original.

  1. Open the copy.
  2. Select the compare button (Compare with source) at the top right.

Nimzo compares the copy with the current version of the original. Details lists each detail that differs. A text shows in full, with the words you removed struck through in red and the words you added in green. A list, such as the labels, shows only the items you removed and added. Then policy.rego and policy_test.rego show the lines removed from the original and the lines you added. The package line always differs, because your copy has its own policy ID.

The button only shows on an edited copy. An unedited copy matches the original as it was when you forked it.

You can delete Custom policies. A Vendor policy has no delete button.

  1. Open the policy.
  2. Select the trash button (Delete policy) at the top right.
  3. Select Delete to confirm.

Nimzo says Policy deleted and opens the Policies page. The policy keeps its public ID reserved, but its Rego package can be used again. If the policy has a draft, Nimzo deletes the draft too. To delete several policies at once, see Work on several policies.

  1. Open the policy.
  2. Select Assign to bundle.
  3. In Bundle, choose a bundle of your organization.
  4. Select Assign.

Nimzo says Policy assigned. The list only offers bundles that do not hold the policy yet. A policy with only a draft has no Assign to bundle button, because a bundle needs a version. The Bundles card on the policy page lists the bundles that hold the policy. See bundles.

  1. On the Policies page, select Select policies.
  2. Select the box of each policy. The box in the column head selects every policy that matches your filters. To select a range, hold Shift and select a row.
  3. Use the bar at the bottom of the page. It counts your selection, for example “3 policies selected”, split into Custom and Vendor policies:
    • Delete 2 customer policies deletes the Custom policies of your selection. Select Delete to confirm. A deleted policy keeps its public ID reserved, but its Rego package can be used again.
    • Fork 1 vendor policy copies the Vendor policies of your selection. Select Fork policies to confirm.
    • Create bundle from 3 policies opens a dialog. Type a Bundle name, add a Description (optional), and select Create and configure.
  4. To empty the selection, select Clear. To leave selection mode, select Cancel selection.

You can only delete Custom policies and only fork Vendor policies. A button stays off when your selection holds none of that kind. Nimzo shows a message while it works: Policies deleted or Policies forked.

Action Vendor policy Custom policy
Open and read it Yes Yes
Assign it to a bundle Yes Yes
Edit it No, fork it first Yes
Fork it Yes Yes, unless it is an unedited fork
Delete it No Yes
  • “Could not load policies. Check your connection and try again.” Select Retry.
  • “Could not load this policy. Check your connection and try again.” Select Retry.
  • “This policy does not exist, or you cannot see it.” Select Back to policies.
  • “Could not fork the policy. Try again, or ask an Admin if the organization has no policy ID prefix.” Try again. If the message stays, ask an Admin to set the policy ID prefix.
  • “Configuring a policy prefix needs the Admin role. Ask an Admin of this organization.” Ask an Admin to save the prefix, or to change it in Settings.
  • “Could not delete the policy. Try again.” Select Delete again.
  • “Could not delete 2 policies. Try again.” or “Could not fork 2 policies. Try again.” The message gives the number that failed. Select the policies again and repeat the action.
  • “The policy is not valid.” The message lists each problem, with the path of the field. Fix the Rego or the details, then save again.
  • “Both policy.rego and policy_test.rego are required.” Fill in both files.
  • “Could not save the policy. Check that the package is not already used, and that your organization has a policy ID prefix.” Change the package line of policy.rego, or set the prefix. A deleted policy frees its package.
  • “Could not save this version. Keep the Rego package unchanged, then try again.” Put the original package line back in policy.rego.
  • “The draft is the same as the current version. Edit the draft to change it, or discard it.” Make a change in the draft, or discard it.
  • “The draft changed while publishing. Review the latest draft and publish again.” Someone saved the draft while you published. Read the draft in the Versions tab, then select Publish again.
  • “The draft is not valid.” The message says why. Select Edit draft, fix it, and publish again.
  • “Could not publish the draft. Check your connection and try again.” Select Publish again.
  • “Could not load the policy for editing. Its files and metadata must be available before you make changes.” Select Retry.
  • “Could not create the bundle. Try again.” Select Create and configure again. If the name is in use, Nimzo says Another bundle already uses this name. Pick a different one.