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

Non String Values are not Masked #17

Open
OmarAlJarrah opened this issue Jul 2, 2024 · 0 comments
Open

Non String Values are not Masked #17

OmarAlJarrah opened this issue Jul 2, 2024 · 0 comments

Comments

@OmarAlJarrah
Copy link

Issue Report

Using the JsonFieldPatternBuilder, the masker appears to only mask string values, while ignoring other non-string values (e.g. numbers, booleans, ...etc).

Expected Behavior

{"name": "omitted", "id": "omitted"}

Actual Behavior

{"name": "omitted", "id": 125}

Steps to Reproduce the Issue

Check the following piece of code:

class SampleJsonFilter: BaseFilter(JsonFieldPatternBuilder::class.java,  *maskedFields) {
    override fun getPatternBuilder(): Class<out IPatternBuilder> = JsonMaskPatternBuilder::class.java

    override fun getFieldNames(): Array<String> = arrayOf("name", "id")
}

fun main() {
    var masked = ""
    json = "{ \"name\": "Linux", \"id\": 125 }"
    val maskingConfig = JsonMaskingConfig.builder()
        .maskKeys(maskedFields.toSet())
        .maskStringsWith("omitted")
        .build()

    val masker = JsonMasker.getMasker(maskingConfig)
    EJMaskInitializer.addFilter(SampleJsonFilter())
}
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

No branches or pull requests

1 participant