Jira (PUP-10092) Support concatenating sensitive values

14 views
Skip to first unread message

Josh Cooper (JIRA)

unread,
Oct 4, 2019, 6:09:03 PM10/4/19
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Puppet / Improvement PUP-10092
Support concatenating sensitive values
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2019/10/04 3:08 PM
Priority: Normal Normal
Reporter: Josh Cooper

The compiler evaluates interpolated sensitive values differently than non-interpolated ones, which is surprising:

$secret = Sensitive('s3cret')
notify { 'a': message => $secret }
notify { 'b': message => "${secret}" }

The first resource evaluates to:

      "parameters": {
        "message": "s3cret"
      },
      "sensitive_parameters": [
        "message"
      ]

While the second evaluates to:

      "parameters": {
        "message": "Sensitive [value redacted]"
      }

Note the second one is lossy, as we no longer know what the original value was.

It would be preferable for the compiler to retain the sensitive data type during interpolation (when evaluating the concatenate expression). So for example "foo $secret" would produce a sensitive value whose unwrapped value was "foo s3cret".

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Rob Braden (JIRA)

unread,
Oct 7, 2019, 1:04:03 PM10/7/19
to puppe...@googlegroups.com
Rob Braden updated an issue
Change By: Rob Braden
Sprint: Coremunity Grooming

Jorie Tappa (JIRA)

unread,
Oct 7, 2019, 2:57:03 PM10/7/19
to puppe...@googlegroups.com
Jorie Tappa updated an issue
Change By: Jorie Tappa
Team: Coremunity

Josh Cooper (JIRA)

unread,
Dec 6, 2019, 1:09:03 PM12/6/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Coremunity Grooming

Henrik Lindberg (JIRA)

unread,
Dec 6, 2019, 2:16:04 PM12/6/19
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-10092
 
Re: Support concatenating sensitive values

A string interpolation has a contract - it is supposed to produce a String not a Sensitive. I think this is slippery slope of special case handling akin to automatic cast from string to number.

You are not supposed to use Sensitive like this and it did exactly what it was suppose to and it resulted in "[redacted]". If using unwrap och rewrap() functions are too difficult, how about adding one more senstive_concatenate() that does that. It would always return Sensitive.

Josh Cooper (JIRA)

unread,
Jan 7, 2020, 2:35:03 PM1/7/20
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10092

The ship may have already sailed, but would it be better if Sensitive was a trait of a type instead of a type, e.g. Binary.new("foo", sensitive: true), String.new("foo", sensitive: true) That way interpolation could preserve the "sensitive-ness" trait, but always return a String?

Henrik Lindberg (JIRA)

unread,
Jan 7, 2020, 5:35:04 PM1/7/20
to puppe...@googlegroups.com

That would mean having to encode "sensitive" into each and every value, integers, floats, strings etc. and that could have drastic impact on performance. The trait of being "sensitive" would then need to be handled by all operations on all those types as we need to automatically propagate the sensitive bit to the results of operations. Thus being lots of code that needs to be touched in many places, and would probably result in instabilities and subtle bugs until we manage to sort it out. So no, don't think this is a viable option.

I did consider using the "tainted" bit available in Ruby since it handles such propagation, but it is for almost the opposite of what we want and it turned out to be a very bad idea to use it for some other purpose than what it is intended for.

I think the best we can do is to have a different function for EPP templates that produces a sensitive result if it interpolates sensitive. For regular string interpolation it is tricky since calling a function would not work since you would like to pass the string with interpolations to it for evaluation and that would mean evaluating it, which would mean getting "redacted" text into the string. It works for EPP since the argument to the epp functions isn't evaluated.

For interpolation into a string we would need a special interpolation instruction, or some new keyword / operator in the language that would tell the evaluator that the interpolation should unwrap and wrap the final result in a sensitive if it interpolates a sensitive.

Josh Cooper (Jira)

unread,
Jun 6, 2020, 7:07:03 PM6/6/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Epic Link: PUP- 9637 8587
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Feb 3, 2021, 8:02:03 PM2/3/21
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10092

Ok, it sounds like rewrap is the way to go. I'm going to close this as a dup of PUP-10093

Reply all
Reply to author
Forward
0 new messages