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

Resource collectors can be assigned to variables by abusing chaining statements

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Done
    • PUP 3.7.5
    • PUP 4.1.0
    • Language
    • None
    • Bug Fix

    Description

      The 4x parser generally refuses to produce values from resource collectors, and errors if you put one where a value is expected. But since the value of a chaining statement is just the final term of the statement (regardless of arrow direction) and they accept collectors as operands:

      notify {"I go last.":}
      $myweirdchain = (file {"/tmp/thing": ensure => file,} -> Notify <| |>)
      notice( $myweirdchain )
      

      Notice: Scope(Class[main]): [#<Puppet::Pops::Evaluator::Collectors::CatalogCollector:0x007fe33da72c90>]
      

      I don't really have anything to add, and probably no one will ever try to do that. But it does seem unintended.

      risk: medium (manual validate only for now)
      probability: low
      severity: medium (confusion, possible abuse?)
      test layer: unit (no unit tests added in PR. henrik.lindberg can you comment on if you think this needs testing, and at what layer?)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nick.fagerlund Nicholas Fagerlund
              Eric Thompson Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support