siyul-park / uniflow

A high-performance, extremely flexible, and easily extensible universal workflow engine.
MIT License
42 stars 5 forks source link

[ support ] Execute a shell script #159

Open yonas opened 2 months ago

yonas commented 2 months ago

Is it possible to execute a shell script?

siyul-park commented 2 months ago

It is not supported by default due to security concerns, but you can implement the Compiler and Program from the language package to add this functionality.


func NewCompiler() language.Compiler {
    return language.CompileFunc(func(code string) (language.Program, error) {
        return language.RunFunc(func(_ any) (any, error) {
            return code, nil
        }), nil
    })
}
langs := language.NewModule()
langs.Store(text.Language, text.NewCompiler())
lang.Store(json.Language, json.NewCompiler())
langs.Store(yaml.Language, yaml.NewCompiler())
langs.Store(cel.Language, cel.NewCompiler())
langs.Store(javascript.Language, javascript.NewCompiler())
langs.Store(typescript.Language, typescript.NewCompiler())

sbuilder.Register(control.AddToScheme(langs, cel.Language))

After finding a way to resolve the security issues, we will add this feature to the roadmap. What is the reason for wanting to execute shell scripts?