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

feat(*): mask sensitive values in console output #251

Merged
merged 2 commits into from
Apr 10, 2019

Conversation

vdice
Copy link
Member

@vdice vdice commented Apr 5, 2019

Mask values in console output if value is:

  • a credential
  • an output
  • a parameter if designated as sensitive

Implements #132

@ghost ghost assigned vdice Apr 5, 2019
@ghost ghost added the review label Apr 5, 2019
@@ -63,6 +63,9 @@ parameters:
- name: mysql_user
type: string
default: azureuser
- name: mysql_password
type: string
sensitive: true
Copy link
Member

Choose a reason for hiding this comment

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

🔐

}
case "dependencies":
for _, dep := range m.Dependencies {
if dep.Name == sourceName {
return dep.resolveValue(key)
replacement, err := dep.resolveValue(key)
// Retrieve updated list of sensitive values from dependency and add to our list
Copy link
Member

Choose a reason for hiding this comment

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

I think I see why you put this here, but it really will need to be refactored or improved later. It's problematic that we need to remember to do this after calling dep.resolveValue and points to a leaky abstraction with how we are either managing our dependencies or how we are collecting and managing these sensitive values I think.

pkg/context/context.go Outdated Show resolved Hide resolved

err = r.Run()
assert.NoError(t, err)
assert.Contains(t, string(output.Bytes()), "Hello *******")
Copy link
Member

Choose a reason for hiding this comment

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

🎉

@@ -113,6 +113,9 @@ func (p *Porter) Run(opts RunOptions) error {
if err != nil {
return errors.Wrap(err, "unable to resolve sourced values")
}
// Hand over values needing masking in context output streams
p.Context.SetSensitiveValues(p.Manifest.GetSensitiveValues())
Copy link
Member

Choose a reason for hiding this comment

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

Ok, so this is in reference to the comment above about refactoring. What do you think about having p.Context.AppendSensitiveValue("poop")? Then as the manifest finds sensitive words, instead of the manifest tracking them in a slice, and having to coordinate passing it back to the context here (and then also after resolving the dependency's values), it could append to them as it finds them?

You are closer to this, so let me know if you think that would help reduce complexity or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

In talking about this offline, I believe we came to the consensus that we're good with revisiting this area of the code after some near-term refactoring.

@vdice vdice force-pushed the feat/mask-values branch 2 times, most recently from e40656d to 4b8ec02 Compare April 8, 2019 21:02
@vdice vdice force-pushed the feat/mask-values branch 2 times, most recently from b4a52ae to 8b84627 Compare April 10, 2019 00:14
@vdice vdice marked this pull request as ready for review April 10, 2019 00:16
@vdice vdice force-pushed the feat/mask-values branch from 8b84627 to 80923b2 Compare April 10, 2019 03:30
Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

LGTM but since @jeremyrickard just nuked those functions in his new PR, let's have you to work on getting this merged and his nicely.

@vdice vdice merged commit c6815ad into getporter:master Apr 10, 2019
@vdice vdice deleted the feat/mask-values branch April 10, 2019 17:46
@ghost ghost removed the review label Apr 10, 2019
carolynvs added a commit to carolynvs/porter that referenced this pull request Jun 2, 2021
* jsonschema-lock is finally merged and we can get rid of our fork
* Allow numbers in bundle.json again
* Add support for params of type array
* Add ValidateSchema function
* Add output validation
* Validate parameter defaults
* Validate param regardless of if override or default
* Fix retrieval of outputs when characters in the result id are in the
output name
* Add support for params of object type in ConvertValue (getporter#251)
* Use alternate canonical json library
* Bump docker libraries to newer version

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
carolynvs added a commit to carolynvs/porter that referenced this pull request Jun 3, 2021
* jsonschema-lock is finally merged and we can get rid of our fork
* Allow numbers in bundle.json again
* Add support for params of type array
* Add ValidateSchema function
* Add output validation
* Validate parameter defaults
* Validate param regardless of if override or default
* Fix retrieval of outputs when characters in the result id are in the
output name
* Add support for params of object type in ConvertValue (getporter#251)
* Use alternate canonical json library
* Bump docker libraries to newer version

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants