Skip to content

PathMask: unable to mask an array element by its index #735

Open
@brenuart

Description

@brenuart

Suppose a configuration that produces the following JSON:

{
   "array": ["a", {"foo":"bar"}]
}

If you want to mask the second array entry you should configure a MaskingJsonGeneratorDecorator with a PathMask of /array/1. This should produce the following result:

{
   "array": ["a", "****"]
}

Unfortunately this doesn't work and nothing is masked. To recap the observed behaviour:

PathMask Comment
/array Path points to the array field whose content is entirely masked.

Result: { "array": "****" }
/array/1 Path points to the second array entry BUT nothing is masked.

Result: "{ array": ["a", {"foo":"bar"}] }
Expected: "{ array": ["a", "****"] }
/array/1/foo Path points to the foo property of the second entry which is masked. This shows that a path can correctly identify an array entry by its index.

Result: "{ array": ["a", {"foo":"****"}] }

logstash-logback-encoder: 7.0.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions