https://github.com/robtimus/obfuscation-core
Provides functionality for obfuscating text
https://github.com/robtimus/obfuscation-core
java obfuscation
Last synced: about 1 month ago
JSON representation
Provides functionality for obfuscating text
- Host: GitHub
- URL: https://github.com/robtimus/obfuscation-core
- Owner: robtimus
- License: apache-2.0
- Created: 2020-05-03T12:04:25.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-27T14:31:41.000Z (10 months ago)
- Last Synced: 2025-04-24T02:53:36.886Z (about 1 month ago)
- Topics: java, obfuscation
- Language: Java
- Homepage: https://robtimus.github.io/obfuscation-core
- Size: 984 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# obfuscation-core
[](https://search.maven.org/artifact/com.github.robtimus/obfuscation-core)
[](https://github.com/robtimus/obfuscation-core/actions/workflows/build.yml)
[](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Aobfuscation-core)
[](https://sonarcloud.io/summary/overall?id=com.github.robtimus%3Aobfuscation-core)
[](https://snyk.io/test/github/robtimus/obfuscation-core)Provides functionality for obfuscating text. This can be useful for logging information that contains sensitive information.
Besides providing a framework that can be extended to provide simple or complex obfuscators, this library comes with a small set of predefined obfuscators.
Most can be found through factory methods on class [Obfuscator](https://robtimus.github.io/obfuscation-core/apidocs/com/github/robtimus/obfuscation/Obfuscator.html).
See [Examples](https://robtimus.github.io/obfuscation-core/examples.html) for more information.## Streaming obfuscation
An `Obfuscator` has method `streamTo` which takes a `StringBuilder`, `Writer` or other `Appendable`, and returns a `Writer` that will obfuscate the written text automatically.
## Preventing leaking string representations
The following methods of `Obfuscator` can be used to help prevent accidentally leaking string representations of objects, for instance by logging them:
* `obfuscateList`, `obfuscateSet` and `obfuscateCollection` create `List`, `Set` and `Collection` decorators respectively that obfuscate separate elements when calling `toString()`.
* `obfuscateMap` creates a `Map` decorator that obfuscates separate values (but not keys) when calling `toString()`.
* `obfuscateObject` creates a wrapper around an existing object that obfuscates the object when calling `toString()`.## Obfuscating complex structures
Besides obfuscating simple text, it's possible to obfuscate complex structures using the following classes and libraries:
* [MapObfuscator](https://robtimus.github.io/obfuscation-core/apidocs/com/github/robtimus/obfuscation/MapObfuscator.html) can obfuscate maps by providing a separate `Obfuscator` for each entry. Entries can even have no obfuscation at all.
* [PropertiesObfuscator](https://robtimus.github.io/obfuscation-core/apidocs/com/github/robtimus/obfuscation/PropertiesObfuscator.html) can obfuscate `Properties` objects by providing a separate `Obfuscator` for each property. Properties can even have no obfuscation at all.
* [obfuscation-commons-lang](https://robtimus.github.io/obfuscation-commons-lang/) provides extensions to [Apache Commons Lang](https://commons.apache.org/proper/commons-lang/) for obfuscating objects.
* [obfuscation-http](https://robtimus.github.io/obfuscation-http/) provides support for obfuscating HTTP requests and responses.
* [obfuscation-jackson](https://robtimus.github.io/obfuscation-jackson/) and [obfuscation-json](https://robtimus.github.io/obfuscation-json/) provide support for obfuscating properties in JSON documents.
* [obfuscation-xml](https://robtimus.github.io/obfuscation-xml/) provides support for obfuscating properties in XML documents.
* [obfuscation-yaml](https://robtimus.github.io/obfuscation-yaml/) provides support for obfuscating properties in YAML documents.## Writing custom obfucators
Package [com.github.robtimus.obfuscation.support](https://robtimus.github.io/obfuscation-core/apidocs/com/github/robtimus/obfuscation/support/package-summary.html) provides several classes that can be used to create custom obfuscators.
## Extensions
* [obfuscation-annotations](https://robtimus.github.io/obfuscation-annotations/) provides general purpose `Obfuscator` annotations.
* [obfuscation-jackson-databind](https://robtimus.github.io/obfuscation-jackson-databind/) provides integration with [jackson-databind](https://github.com/FasterXML/jackson-databind).
* [obfuscation-spring](https://robtimus.github.io/obfuscation-spring/) provides integration with [Spring](https://spring.io/) and [Spring Boot](https://spring.io/projects/spring-boot).