Skip to content

Commit 4760909

Browse files
committed
Disable env access and file load operations in yqlib
Signed-off-by: Jan Dubois <[email protected]>
1 parent e1dc411 commit 4760909

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/yqutil/yqutil.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func EvaluateExpressionWithEncoder(expression, content string, encoder yqlib.Enc
5050
logging.SetBackend(backend)
5151
yqlib.InitExpressionParser()
5252

53+
// Disable access to environment variables and file loading functions
54+
yqlib.ConfiguredSecurityPreferences.DisableEnvOps = true
55+
yqlib.ConfiguredSecurityPreferences.DisableFileOps = true
56+
5357
decoder := yqlib.NewYamlDecoder(yqlib.ConfiguredYamlPreferences)
5458
out, err := yqlib.NewStringEvaluator().EvaluateAll(expression, content, encoder, decoder)
5559
if err != nil {

0 commit comments

Comments
 (0)