Skip to content

Is passing user-controlled expressions to yq secure? #1961

Answered by mikefarah
MaeIsBad asked this question in Q&A
Discussion options

You must be logged in to vote

I wouldn't recommend it - it wasn't designed for that and I can't guarantee any security for allowing end users to provide expressions. It would be like allowing end users to specify there own SQL query.

  • yq can access environment variables, which you have already identified
  • yq can access files on the operating system, via the load expression - https://mikefarah.gitbook.io/yq/operators/load
  • it doesn't make http calls
  • there's probably other sneaky stuff you could do in the expression that I'm not aware of; possibly issues in underlying libraries; that expose security vulnerabilities

If you had to do it, I'd run yq in a container (e.g. docker/podman/vm) and make sure it only had access to …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MaeIsBad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants