shellvsexec.adoc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. = Shell vs Exec
  2. OliveTin supports two different methods to run commands: `shell` and `exec`. The difference between these two is that "shell" accepts strings, and will wrap that whole command in a shell with "bash -c". Exec uses a syscall directly to execute commands.
  3. * **Shell** is more flexible, because it allows you to chain commands (eg, using &&) and redirect or pipe output (eg: ">" or "|").
  4. * **Exec** is more secure, because it does not invoke a shell, and thus avoids shell injection attacks.
  5. Shell can be safe and secure with simple argument types (like ascii_identifier), but some argument types like URL can contain basically any character - /, :, ?, &, etc - which can lead to shell injection vulnerabilities while still being a valid URL.
  6. OliveTin will try and prevent you from using dangerous characters in shell commands (eg, URL is no longer permitted with Shell).
  7. The way that you specify these two types of execution is different - `shell` expects a single string, while `exec` expects a list of strings (the first being the command, the rest being the arguments).
  8. [source,yaml]
  9. .Using Shell
  10. ----
  11. actions:
  12. - title: List files
  13. shell: ls -l /some/directory
  14. ----
  15. [source,yaml]
  16. .Using Exec
  17. ----
  18. actions:
  19. - title: List files
  20. exec:
  21. - ls
  22. - -l
  23. - /some/directory
  24. ----
  25. When in doubt, prefer `exec` over `shell` for better security. Shell was added in both OliveTin 3k and OliveTin 2k in October 2025.
  26. == What's Next?
  27. Now that you understand execution methods, continue building your actions:
  28. * xref:action_execution/create_your_first.adoc[Create your first action] - Build a simple action to get started
  29. * xref:args/intro.adoc[Add arguments to actions] - Make actions interactive with user input
  30. * xref:action_execution/oncron.adoc[Schedule actions] - Set up automated execution
  31. * xref:action_execution/onwebhook.adoc[Trigger via webhooks] - Integrate with external systems
  32. * xref:security/concepts.adoc[Configure security] - Secure your actions with authentication and authorization
  33. * xref:action_examples/intro.adoc[Browse examples] - See real-world action configurations