Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-8175) Add safety to new-pscredential helper #91

Merged
merged 1 commit into from
Dec 7, 2018
Merged

(MODULES-8175) Add safety to new-pscredential helper #91

merged 1 commit into from
Dec 7, 2018

Conversation

michaeltlombardi
Copy link
Contributor

@michaeltlombardi michaeltlombardi commented Dec 6, 2018

Prior to this commit the helper function new-pscredential
in the template used to invoke DSC resources attempted to
cast an incoming value for password to a string. When passed
a hashtable, it was unable to extract the password for use
and instead set the password as the typename for the object.

This happened when the catalog was compiled on a Puppet 5
master to apply to a Puppet 6 agent or when compiled on a
Puppet 6 master for a Puppet 5 agent and specifying the
password using the sensitive datatype.

This problem was introduced in MODULES-8597 when the tags
for rich data serialization were changed from __pcore_type_
and __pcore_value__ to the shorter __ptype and __pvalue.
After this change, the master and agent both expect different
keys for the sensitive data type, which is why this problem
only shows when the master and agent are mismatched versions.

This commit modifies the new-pscredential helper function
to include handling for both strings and hashtables, and
will extract the password if possible and error loudly if
not.

@michaeltlombardi michaeltlombardi changed the title (WIP) (MODULES-8175) Add safety to new-pscredential helper (MODULES-8175) Add safety to new-pscredential helper Dec 7, 2018
RandomNoun7
RandomNoun7 previously approved these changes Dec 7, 2018
Prior to this commit the helper function `new-pscredential`
in the template used to invoke DSC resources attempted to
cast an incoming value for password to a string. When passed
a hashtable, it was unable to extract the password for use
and instead set the password as the typename for the object.

This happened when the catalog was compiled on a Puppet 5
master to apply to a Puppet 6 agent or when compiled on a
Puppet 6 master for a Puppet 5 agent and specifying the
password using the sensitive datatype.

This problem was introduced in MODULES-8597 when the tags
for rich data serialization were changed from `__pcore_type_`
and `__pcore_value__` to the shorter `__ptype` and `__pvalue`.
After this change, the master and agent both expect different
keys for the sensitive data type, which is why this problem
only shows when the master and agent are mismatched versions.

This commit modifies the `new-pscredential` helper function
to include handling for both strings and hashtables, and
will extract the password if possible and error loudly if
not.
@RandomNoun7 RandomNoun7 merged commit 39fabf2 into puppetlabs:master Dec 7, 2018
$password
)

Switch ($password.GetType().FullName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm - I'm a little confused on why we're doing all of this special handling on the PowerShell side instead of just munging the value consistently on the Ruby side?

@Iristyle
Copy link
Contributor

This will be reverted in favor of #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants