kafka-ui icon indicating copy to clipboard operation
kafka-ui copied to clipboard

As a user I want to be able to mask only the nested field of a message but not all fields

Open SamsadSajid opened this issue 1 year ago • 2 comments

Issue submitter TODO list

  • [X] I've searched for an already existing issues here
  • [X] I'm running a supported version of the application which is listed here and the feature is not present there

Is your proposal related to a problem?

No response

Describe the feature you're interested in

Issue 1

The data masking document describes how to mask data but the examples contain linear field names. However, the document says that

Note: if target field's value is object, then replacement applied to all its fields recursively (see example).

The given example in the document was:

- type: REPLACE
  fields: [ "id", "name" ]
  replacement: "***"  #optional, "***DATA_MASKED***" by default

which results in

{ "id": 1234, "name": { "first": "James", "last": "Bond" }, "age": 30 } 
 ->
{ "id": "***", "name": { "first": "***", "last": "***" }, "age": 30 } 

But this should not be the desired behaviour. A nested object can contain multiple fields. Those fields can be tremendously helpful to view from Kafka-ui. But with the current version of Kafka-ui, this is not achievable as Kafka-ui masks all internal fields.

The desired behaviour should be:

- type: REPLACE
  fields: [ "id", "name.first" ] // or some other config
  replacement: "***"  #optional, "***DATA_MASKED***" by default

which should result in

{ "id": 1234, "name": { "first": "James", "last": "Bond" }, "age": 30 } 
 ->
{ "id": "***", "name": { "first": "***", "last": "Bond" }, "age": 30 } 

Issue 2

If there are multiple fields with the same name present in a message, all fields are masked.

Example:

name: "test",
id: 1
meta: {
  id: 2,
  ...
}

Say, I want to mask only the meta.id field. But if I mention id in the fields list, it masks all fields with the name id. So the above message becomes:

name: "test",
id: ****
meta: {
  id: ****,
  ...
}

Summary

Combining the above two issues, as a user of Kafka-UI, it would be great to have config settings where I can say exactly what fields in a message I want to mask.

Describe alternatives you've considered

No response

Version you're running

0.7.1

Additional context

I have proto models serde to deserialize the messages in Kafka-ui

SamsadSajid avatar Jan 15 '24 16:01 SamsadSajid

Hello there SamsadSajid! 👋

Thank you and congratulations 🎉 for opening your very first issue in this project! 💖

In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. 👀

github-actions[bot] avatar Jan 15 '24 16:01 github-actions[bot]

I am thinking out loud here: since Kafka-ui is doing the deserialisation with the Proto serde, it should know the structure of the message i.e., fields and its nested structure. In that case, can't Kafka-ui use this context to mask only the required fields? i.e., if I mention only fields: [ "id", "name.first" ], can't Kafka-ui use the proto-model structure to only mask the first field of name field?

SamsadSajid avatar Jan 15 '24 16:01 SamsadSajid