Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3142

exec type should allow passing of arguments as an array rather than a string

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
    • Template:
    • Epic Link:
    • Team:
      Coremunity

      Description

      The exec type takes commands and arguments as a string, (@"echo foo"@) which will then get passed to /bin/sh (@sh -c "echo foo"@) by Kernel#system.

      This can make things pretty awkward if the command you're trying to execute contains shell metacharacters or quotes of its own, and under appropriately pathological conditions could even be a security problem... (username '"&&rm -rf /' or something? shrug)

      It'd be grand if the exec type would support passing things around as arrays. eg:

      exec {"example":
        command => "/bin/echo",
        arguments => ["*", "yay", "*"],
      }
      

      (Passing an array to Kernel#system bypasses the shell completely: http://www.ruby-doc.org/core/classes/Kernel.html#M005982)

      -sq

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              redmine.exporter redmine.exporter
              QA Contact:
              Eric Thompson
            • Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support