{"id":20741119,"url":"https://github.com/robtimus/obfuscation-jackson","last_synced_at":"2025-04-14T11:32:04.597Z","repository":{"id":57722446,"uuid":"260905322","full_name":"robtimus/obfuscation-jackson","owner":"robtimus","description":"Provides functionality for obfuscating JSON using Jackson","archived":false,"fork":false,"pushed_at":"2024-01-20T12:53:03.000Z","size":684,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T00:44:08.390Z","etag":null,"topics":["jackson","java","json","obfuscation"],"latest_commit_sha":null,"homepage":"https://robtimus.github.io/obfuscation-jackson","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robtimus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-03T12:06:10.000Z","updated_at":"2025-02-19T11:53:45.000Z","dependencies_parsed_at":"2023-02-15T17:46:14.974Z","dependency_job_id":"eb1eddc9-833c-448b-bbed-f1b428e54e25","html_url":"https://github.com/robtimus/obfuscation-jackson","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-jackson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-jackson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-jackson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robtimus%2Fobfuscation-jackson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robtimus","download_url":"https://codeload.github.com/robtimus/obfuscation-jackson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248871843,"owners_count":21175302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jackson","java","json","obfuscation"],"created_at":"2024-11-17T06:33:55.965Z","updated_at":"2025-04-14T11:32:04.577Z","avatar_url":"https://github.com/robtimus.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# obfuscation-jackson\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.robtimus/obfuscation-jackson)](https://search.maven.org/artifact/com.github.robtimus/obfuscation-jackson)\n[![Build Status](https://github.com/robtimus/obfuscation-jackson/actions/workflows/build.yml/badge.svg)](https://github.com/robtimus/obfuscation-jackson/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Aobfuscation-jackson\u0026metric=alert_status)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Aobfuscation-jackson)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=com.github.robtimus%3Aobfuscation-jackson\u0026metric=coverage)](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Aobfuscation-jackson)\n[![Known Vulnerabilities](https://snyk.io/test/github/robtimus/obfuscation-jackson/badge.svg)](https://snyk.io/test/github/robtimus/obfuscation-jackson)\n\nProvides functionality for obfuscating JSON documents. This can be useful for logging such documents, e.g. as part of request/response logging, where sensitive properties like passwords should not be logged as-is.\n\nTo create a JSON obfuscator, simply create a builder, add properties to it, and let it build the final obfuscator:\n\n    Obfuscator obfuscator = JSONObfuscator.builder()\n            .withProperty(\"password\", Obfuscator.fixedLength(3))\n            .build();\n\n## Obfuscation for objects and/or arrays\n\nBy default, a JSON obfuscator will obfuscate all properties; for object and array properties, their contents in the document including opening and closing characters will be obfuscated. This can be turned on or off for all properties, or per property. For example:\n\n    Obfuscator obfuscator = JSONObfuscator.builder()\n            .scalarsOnlyByDefault()\n            // .scalarsOnlyByDefault() is equivalent to:\n            // .forObjectsByDefault(ObfuscationMode.EXCLUDE)\n            // .forArraysByDefault(ObfuscationMode.EXCLUDE)\n            .withProperty(\"password\", Obfuscator.fixedLength(3))\n            .withProperty(\"complex\", Obfuscator.fixedLength(3))\n                    .forObjects(ObfuscationMode.OBFUSCATE) // override the default setting\n            .withProperty(\"arrayOfComplex\", Obfuscator.fixedLength(3))\n                    .forArrays(ObfuscationMode.INHERIT_OVERRIDABLE) // override the default setting\n            .build();\n\nThe four possible modes for both objects and arrays are:\n* `EXCLUDE`: don't obfuscate nested objects or arrays, but instead traverse into them.\n* `OBFUSCATE`: obfuscate nested objects and arrays completely (default).\n* `INHERIT`: don't obfuscate nested objects or arrays, but use the obfuscator for all nested scalar properties.\n* `INHERIT_OVERRIDABLE`: don't obfuscate nested objects or arrays, but use the obfuscator for all nested scalar properties. If a nested property has its own obfuscator defined this will be used instead.\n\n## Handling malformed JSON\n\nIf malformed JSON is encountered, obfuscation aborts. It will add a message to the result indicating that obfuscation was aborted. This message can be changed or turned off when creating JSON obfuscators:\n\n    Obfuscator obfuscator = JSONObfuscator.builder()\n            .withProperty(\"password\", Obfuscator.fixedLength(3))\n            // use null to turn it off\n            .withMalformedJSONWarning(\"\u003cinvalid JSON\u003e\")\n            .build();\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fobfuscation-jackson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtimus%2Fobfuscation-jackson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtimus%2Fobfuscation-jackson/lists"}