# The specific refusal and the general flag.
#
# The specific rule silences the general one it refines without any override
# mechanism: rules evaluate in a deterministic order ([OAR-EVAL-1]) and the
# first block short-circuits the occurrence ([OAR-EVAL-3]). Both rules are `policy` kind, so
# ascending id order puts DELETE_REFUSED first: a delete is refused outright and
# the occurrence ends there, while the state changes that are still allowed are
# flagged by the rule below.
spec_version: "1.0"
id: DELETE_REFUSED
namespace: example.security
kind: policy
on: tool.pre_invoke
selector:
  tools: [delete]
effect: block
profile: portable
what: This tool destroys state the session cannot restore.
fix: Move the files to a holding path instead of deleting them.
---
spec_version: "1.0"
id: DESTRUCTIVE_TOOL_WARN
namespace: example.security
kind: policy
on: tool.pre_invoke
selector:
  tools: [delete, move, chmod]
effect: warn
profile: portable
what: This tool changes state that is awkward to restore.
