Jira (PUP-10511) Sensitive data type is lost when declaring multiple resources using title arrays

0 views
Skip to first unread message

Charlie Sharpsteen (Jira)

unread,
May 14, 2020, 3:04:03 PM5/14/20
to puppe...@googlegroups.com
Charlie Sharpsteen created an issue
 
Puppet / Bug PUP-10511
Sensitive data type is lost when declaring multiple resources using title arrays
Issue Type: Bug Bug
Affects Versions: PUP 6.15.0, PUP 5.5.20
Assignee: Unassigned
Components: Language
Created: 2020/05/14 12:03 PM
Priority: Normal Normal
Reporter: Charlie Sharpsteen

Puppet Version: 6.15.0, 5.5.20
Puppet Server Version: N/A
OS Name/Version: RedHat 7

When multiple resources are declared using an array of titles, the type information for Sensitive parameters is lost. This results in type validation errors if a resource declares a data type such as Sensitive[String]

Install Puppet 6 on CentOS 7 and create a defined type with a password parameter declared to be Sensitive[String]:

cat <<'EOF' > /etc/puppetlabs/code/environments/production/modules/test_mod/manifests/service.pp
define test_mod::service(
  Sensitive[String] $password,
){
  notify{"${title} ${password}": }
}
EOF

Attempt to apply the following manifest:

test_mod::service { ["ServiceA","ServiceB"]:
  password => Sensitive("password")
}

Desired Behavior:

Output matches individual resources declared in a loop:

# puppet apply <<'EOF'
each(["ServiceA","ServiceB"] ) |String $svc_name| {
  test_mod::service { $svc_name:
    password => Sensitive("password")
  }
}
EOF
 
Notice: Compiled catalog for olde-pacemaker.delivery.puppetlabs.net in environment production in 0.02 seconds
Notice: ServiceA Sensitive [value redacted]
Notice: /Stage[main]/Main/Test_mod::Service[ServiceA]/Notify[ServiceA Sensitive [value redacted]]/message: defined 'message' as 'ServiceA Sensitive [value redacted]'
Notice: ServiceB Sensitive [value redacted]
Notice: /Stage[main]/Main/Test_mod::Service[ServiceB]/Notify[ServiceB Sensitive [value redacted]]/message: defined 'message' as 'ServiceB Sensitive [value redacted]'
Notice: Applied catalog in 0.01 seconds

Actual Behavior:

Compilation fails when defining the second resource as password has been coerced to a String:

# puppet apply <<'EOF'
test_mod::service { ["ServiceA","ServiceB"]:
  password => Sensitive("password")
}
EOF
 
Error: Test_mod::Service[ServiceB]: parameter 'password' expects a Sensitive[String] value, got String on node olde-pacemaker.delivery.puppetlabs.net

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Charlie Sharpsteen (Jira)

unread,
May 14, 2020, 3:05:03 PM5/14/20
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
Change By: Charlie Sharpsteen
*Puppet Version:* 6.15.0, 5.5.20
*Puppet Server Version:* N/A
*OS Name/Version:*
RedHat 7 N/A

When multiple resources are declared using an array of titles, the type information for {{Sensitive}} parameters is lost. This results in type validation errors if a resource declares a data type such as {{Sensitive[String]}}

Install Puppet 6 on CentOS 7 and create a defined type with a password parameter declared to be {{Sensitive[String]}}:

{code:bash}

cat <<'EOF' > /etc/puppetlabs/code/environments/production/modules/test_mod/manifests/service.pp
define test_mod::service(
  Sensitive[String] $password,
){
  notify{"${title} ${password}": }
}
EOF
{code}


Attempt to apply the following manifest:

{code:puppet}

test_mod::service { ["ServiceA","ServiceB"]:
  password => Sensitive("password")
}
{code}

*Desired Behavior:*


Output matches individual resources declared in a loop:

{noformat}

# puppet apply <<'EOF'
each(["ServiceA","ServiceB"] ) |String $svc_name| {
  test_mod::service { $svc_name:
    password => Sensitive("password")
  }
}
EOF

Notice: Compiled catalog for olde-pacemaker.delivery.puppetlabs.net in environment production in 0.02 seconds
Notice: ServiceA Sensitive [value redacted]
Notice: /Stage[main]/Main/Test_mod::Service[ServiceA]/Notify[ServiceA Sensitive [value redacted]]/message: defined 'message' as 'ServiceA Sensitive [value redacted]'
Notice: ServiceB Sensitive [value redacted]
Notice: /Stage[main]/Main/Test_mod::Service[ServiceB]/Notify[ServiceB Sensitive [value redacted]]/message: defined 'message' as 'ServiceB Sensitive [value redacted]'
Notice: Applied catalog in 0.01 seconds
{noformat}

*Actual Behavior:*


Compilation fails when defining the second resource as {{password}} has been coerced to a {{String}}:

{noformat}

# puppet apply <<'EOF'
test_mod::service { ["ServiceA","ServiceB"]:
  password => Sensitive("password")
}
EOF

Error: Test_mod::Service[ServiceB]: parameter 'password' expects a Sensitive[String] value, got String on node olde-pacemaker.delivery.puppetlabs.net
{noformat}

Charlie Sharpsteen (Jira)

unread,
May 14, 2020, 3:06:03 PM5/14/20
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
*Puppet Version:* 6.15.0, 5.5.20
*Puppet Server Version:* N/A
*OS Name/Version:* N/A


When multiple resources are declared using an array of titles, the type information for {{Sensitive}} parameters is lost. This results in type validation errors if a resource declares a data type such as {{Sensitive[String]}}

Install Puppet 6 on CentOS 7 and create a defined type with a password parameter declared to be {{Sensitive[String]}}:

{code:bash}
mkdir -p /etc/puppetlabs/code/environments/production/modules/test_mod/manifests

Mihai Buzgau (Jira)

unread,
May 27, 2020, 11:17:04 AM5/27/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
May 28, 2020, 3:58:02 AM5/28/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
May 28, 2020, 3:58:03 AM5/28/20
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jun 2, 2020, 9:47:03 AM6/2/20
to puppe...@googlegroups.com
Ciprian Badescu commented on Bug PUP-10511
 
Re: Sensitive data type is lost when declaring multiple resources using title arrays

What happens is that in first case, there are two distinct password parameters, one for each resource, while in the second case the same parameter is shared by both resources.

This works well for immutable parameters, but we unwrap Sensitive parameters for each resource and password parameter will be unwrapped for ServiceA and then will fail the check for ServiceB as it is already unwrapped.

 

Ciprian Badescu (Jira)

unread,
Jun 3, 2020, 2:54:03 AM6/3/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Jun 10, 2020, 4:54:03 AM6/10/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 12, 2020, 8:15:03 PM6/12/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 6.17.0
Fix Version/s: PUP 5.5.21

Josh Cooper (Jira)

unread,
Jun 12, 2020, 8:15:04 PM6/12/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 12, 2020, 8:16:03 PM6/12/20
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jun 15, 2020, 1:50:03 AM6/15/20
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
 
Change By: Ciprian Badescu
Release Notes: Bug Fix
Release Notes Summary: This commit is fixing support of sensitive data type parameters when declaring multiple resources using title arrays

Claire Cadman (Jira)

unread,
Jul 7, 2020, 6:30:04 AM7/7/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages