Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ The other `assert` commands are narrower checks: `kosli assert pullrequest <prov
To learn more, see [Enforce policies](/getting_started/enforce_policies) for `assert`, and [Evaluate trails with OPA policies](/tutorials/evaluate_trails_with_opa) and the [Rego policy reference](/policy-reference/rego_policy) for `evaluate`.
</Accordion>

<Accordion title="Why can't I delete or archive a policy?">
It's not possible to delete a policy in Kosli. This is by design, because there can be snapshots that were previously evaluated using the policy. Deleting it would compromise the integrity of those historical evaluations.
<Accordion title="Why can't I delete or archive an environment policy?">
It's not possible to delete an environment policy in Kosli. This is by design, because there can be snapshots that were previously evaluated using the policy. Deleting it would compromise the integrity of those historical evaluations.

Archiving policies isn't available yet. If this is something you'd find useful, we'd love to hear about your use case — reach out to us at [email protected].
Archiving environment policies isn't available yet. If this is something you'd find useful, we'd love to hear about your use case — reach out to us at [email protected].

Rego policies can be archived. See [Archiving a policy](/policy-reference/rego_policy#archiving-a-policy).
</Accordion>

</AccordionGroup>
Expand Down
10 changes: 10 additions & 0 deletions policy-reference/rego_policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ opa check --strict --schema input-schema.json --capabilities capabilities.json p

Below `compliance_status`, the input schema does not type fields, so strict mode does not check paths into attestation data.

## Archiving a policy

When you retire a policy, archive it rather than deleting it. Archiving takes the policy out of the default Rego policy list without creating a new version. Its versions, files, and past evaluations stay readable, and its identifier stays taken. Only org admins can archive or unarchive a policy.

Archive or unarchive a policy from the **Settings** tab on its page in the [Kosli app](https://app.kosli.com), from the CLI with [`kosli archive rego-policy`](/client_reference/kosli_archive_rego-policy) and [`kosli unarchive rego-policy`](/client_reference/kosli_unarchive_rego-policy), or through the API (`POST /api/v2/rego-policies/{org}/{identifier}/archive` and `.../unarchive`). To find archived policies, open the **Archived** tab of the policy list or run `kosli list rego-policies --archived`.

The policy's **Audit log** tab lists each archive and unarchive, and each change to its name or description, with who made it and when, newest first.

An archived policy still evaluates: `kosli evaluate policy` runs it by identifier as before. A decision recorded from an archived policy shows a warning mark on the trail, so you can spot pipelines that still depend on a retired policy. The mark reflects the policy's state when the decision was recorded, so archiving a policy later doesn't mark earlier decisions.

## Safe policy design

Three rules prevent a policy from allowing what it should deny.
Expand Down
Loading