Add support for run.shell task#268
Open
mcruzdev wants to merge 1 commit into
Open
Conversation
Implements the RunTask.shell process defined by the Serverless Workflow DSL. Adds a shell runner that evaluates the command, environment and arguments (as runtime expressions), executes it via `sh -c`, and returns output according to the `return` policy (stdout, stderr, code, all, none). - Add `return` to RunTaskConfiguration with oneof validation - Wire RunTask into the task runner dispatch - Support both ordered array and map forms for shell arguments via the RunArguments model (array form preserves order) - Set the command environment via cmd.Env instead of mutating the parent process global environment Closes serverlessworkflow#246 Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Author
|
Replaces #247 |
ricardozanini
left a comment
Member
There was a problem hiding this comment.
The functionallity is correct, but there is a huge security flaw we can't merge before it's solved.
| } | ||
|
|
||
| newCmd := func() *exec.Cmd { | ||
| cmd := exec.Command("sh", "-c", fullCmd.String()) |
Member
There was a problem hiding this comment.
We can't do this directly, as it is a huge security flaw. These commands must run on an isolated process/shell without privileged access. If the workflow process is running with a user with privileged access (aka root), one can inject a script and destroy the environment.
I must do some research around this topic; we can't have a naive implementation for this one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
Implements the RunTask.shell process defined by the Serverless Workflow DSL. Adds a shell runner that evaluates the command, environment and arguments (as runtime expressions), executes it via
sh -c, and returns output according to thereturnpolicy (stdout, stderr, code, all, none).returnto RunTaskConfiguration with oneof validationCloses #246
Special notes for reviewers:
Additional information (if needed):