-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
Fix bug where objects and arrays marked as secret weren't being masked #4236
Fix bug where objects and arrays marked as secret weren't being masked #4236
Conversation
Closes #4235 |
@Kami i was able to find and fix the issue, please let me know if you have any comments |
@nmaludy Thanks, will have a look. |
@@ -669,3 +701,39 @@ def test_mask_secret_parameters_nested_array_with_object(self): | |||
] | |||
} | |||
self.assertEqual(expected, result) | |||
|
|||
def test_mask_secret_array(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also wouldn't hurt to add a test case for scenarios where we have an object which is marked "secret: true" at top level, but it also has a sub-schema with different items of which some have "secret: true" attribute. Same goes for array.
I assume in such scenarios, if top level "secret: true" attribute is present, this top level attribute should have a precedence (and we could even ignore / skip iterating over child object / array attributes).
# is an `object` or `array`, and the user wants the full thing | ||
# to be secret, that it is marked as secret. | ||
if parameters.get('secret', False): | ||
return parameters_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 👍
That's also a more common scenario and it's much more performant :)
Thanks for good work on the tests 👍 |
Most likely due to the re-work of secret masking here #4140
objects
andarrays
that were marked withsecret: true
were not being masked. See #4235 for details on the symptoms.This PR addresses this by looking for the
secret
property onobject
andarray
types. It then treats all data within theobject
orarray
as secret, returning a single masked value.Example of the fixed version:
FYI, i create a unit test for this edge case so we can verify that it is not exposed in the future.