microsoft / regorus

Regorus - A fast, lightweight Rego (OPA policy language) interpreter written in Rust.
MIT License
130 stars 31 forks source link

Provide a way to obtain policy file names and content from an Engine #254

Closed bromls closed 3 months ago

bromls commented 4 months ago

To support use cases like policy auditing, it would be helpful if the Engine exposed a function that allowed callers to iterate over the mappings of policy file names to policy file content. An application that uses Rego policies may be run with different policies over time, as the software or configuration is updated, or based on the runtime environment. For use cases like “Collaboration using Import”, the policy Engine supports composition of packages, and accepts multiple policy files. All of this information is available during Engine creation, as it is input to the add_policy and add_policy_from_file functions. However, some applications may separate Engine creation from where an Engine is used to evaluate rules or queries. Therefore, it would be valuable for an Engine user to have access to the policy file content.

anakrish commented 4 months ago

@bromls How do policies get audited? Do you compute the hash of the policy file contents?