| 1 | |
| 2 | |
| 3 | |
| 4 | package main |
| 5 | |
| 6 | import ( |
| 7 | "github.com/spf13/cobra" |
| 8 | ) |
| 9 | |
| 10 | func newYQRestrictionsHelpCommand() *cobra.Command { |
| 11 | return &cobra.Command{ |
| 12 | Use: "yq-restrictions", |
| 13 | Short: "Restrictions on yq expressions in Lima", |
| 14 | Long: `Lima uses yq (v4) syntax for the --set flag and provision mode "yq". |
| 15 | |
| 16 | Lima embeds yqlib (https://github.com/mikefarah/yq) as a library and |
| 17 | disables several operators to prevent template expressions from reading |
| 18 | the host environment or executing arbitrary commands: |
| 19 | |
| 20 | Disabled by Lima: |
| 21 | - env (environment variable access) |
| 22 | - load, load_str (arbitrary file reads) |
| 23 | |
| 24 | Disabled by yqlib default: |
| 25 | - system (arbitrary command execution) |
| 26 | |
| 27 | These restrictions exist because --set expressions and provision.yq |
| 28 | expressions may come from untrusted template files. Allowing them to |
| 29 | access environment variables, read files, or execute commands on the |
| 30 | host would be a security risk. |
| 31 | |
| 32 | For full yq v4 expression syntax, see: |
| 33 | https://mikefarah.gitbook.io/yq/`, |
| 34 | } |
| 35 | } |