The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #17094

hiera can end up in and endless loop with malformed lookup variables

Added by Peter De Cleyn over 3 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:ImmediateDue date:
Assignee:-% Done:

0%

Category:hiera
Target version:1.3.0
Keywords:backlog Affected Hiera Version:
Branch:https://github.com/puppetlabs/hiera/pull/146

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

When using the variable lookup functionality inside a hiera datafile and the variable name contains meaningful regex characters, unexpected behaviour might occur.

e.g., specifying

key: %{$var}

will cause an endless loop during the hiera lookup .

The cause of this resides in the substitution method in Hiera.Backend.parse_string

Replacing

tdata.gsub!(/%\{(::)?#{var}\}/, val)

by

tdata.gsub!(/%\{(::)?#{Regexp.escape(var)}\}/, val)

solves this.


Related issues

Related to Hiera - Feature #17126: Can't interpolate hash or array members with %{} tokens Accepted

History

#1 Updated by Josh Cooper over 3 years ago

  • Status changed from Unreviewed to Requires CLA to be signed
  • Assignee set to Peter De Cleyn

#2 Updated by Peter De Cleyn over 3 years ago

Done, apologies for the delay!

#3 Updated by Patrick Carlisle about 3 years ago

  • Status changed from Requires CLA to be signed to In Topic Branch Pending Review
  • Target version set to 1.2.0

#4 Updated by Patrick Carlisle about 3 years ago

  • Assignee changed from Peter De Cleyn to Patrick Carlisle

#5 Updated by Anonymous about 3 years ago

  • Priority changed from Normal to Immediate

#6 Updated by Anonymous about 3 years ago

  • Keywords set to backlog

#7 Updated by Matthaus Owens about 3 years ago

  • Target version deleted (1.2.0)

#8 Updated by Anonymous over 2 years ago

  • Assignee changed from Patrick Carlisle to Anonymous

The work on #17434 addressed this issue by changing how lookups are done. PR https://github.com/puppetlabs/hiera/pull/146 adds a test to make sure that we don’t regress.

#9 Updated by Anonymous over 2 years ago

  • Branch set to https://github.com/puppetlabs/hiera/pull/146

#10 Updated by Anonymous over 2 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Target version set to 1.3.0

#11 Updated by Melissa Stone over 2 years ago

  • Status changed from Merged - Pending Release to Closed

Released in Hiera 1.3.0-rc2

Also available in: Atom PDF