Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
genpolicy-msft: relax namespace check in dev
The default Kata policy requires the namespace annotation to match the namespace in the original YAML (or a default value, if absent there). The security benefits of this are unclear - see upstream issue XXX. This requirement makes it unnecessarily hard to generate portable policies. This commit introduces a backwards-compatible tweak to the default rules that allows for namespace flexibility in compiled policies. Instead of a hard equality check we interpret the policy namespace as a regular expression and match the input namespace to it. Since all valid Kubernetes namespaces are RFC 1123 DNS labels [1], they can be used as literal values in regexps, so the behaviour is unchanged for regular YAML with a valid namespace or no namespace at all. To create a portable policy, one fills the namespace field with e.g. "[a-z0-9]{1,63}" before generating the policy, and removes the field afterwards. [1]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#namespaces-and-dns
- Loading branch information