Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
com.github.robtimus:obfuscation-jackson-databind
Advanced tools
Provides support for serializing and deserializing obfuscated values using Jackson
Provides support for serializing and deserializing obfuscated values using Jackson. All you need to do is register a module:
Module module = ObfuscationModule.defaultModule();
mapper.registerModule(module);
This will automatically allow all instances of Obfuscated to be serialized and deserialized, without the need for any custom serializer or deserializer. In fact, any annotation used (apart from the ones below) will be used for the Obfuscated
object's value, not the Obfuscated
object itself. That means that you can provide custom serialization and/or deserialization for the value the way you're used to, without needing to wrap it inside a new serializer or deserializer.
With the annotations from obfuscation-annotations, you can control how values are obfuscated during deserialization. This is supported for the following types:
@ObfuscateFixedLength(3)
or @ObfuscateAll
to specify a custom obfuscator to use for the Obfuscated
property during deserialization.@RepresentedBy
to provide a custom character representation.@ObfuscateFixedLength(3)
or @ObfuscateAll
to apply obfuscation to a List
, Set
, Collection
or Map
property during deserialization. This is done using Obfuscator.obfuscateList, Obfuscator.obfuscateSet, Obfuscator.obfuscateCollection and Obfuscator.obfuscateMap respectively.@RepresentedBy
to provide a custom character representation for the generic element/value type. This annotation will be ignored if no obfuscation is applied to the property.By default, deserialized Obfuscated
properties that are not annotated with any of the annotations from obfuscation-annotations will use Obfuscator.fixedLength(3). This can be overridden by using a builder to create the module. With this builder, it's possible to define default obfuscators per type, or a global default obfuscator:
Module module = ObfuscationModule.builder()
.withDefaultObfuscator(String.class, Obfuscator.portion().keepAtStart(2).build())
.withDefaultObfuscator(Obfuscator.fixedValue("<obfuscated>"))
.build();
mapper.registerModule(module);
A type-specific obfuscator will be used if the generic value type of the Obfuscated
property matches. This takes into account super classes and implemented interfaces. If there is no match, the global default obfuscator is used.
A type-specific obfuscator will be used not just for Obfuscated
properties, but also any List
, Set
, Collection
or Map
property with a matching generic element/value type. This can be disabled by calling requireObfuscatorAnnotation(true)
on the builder. The global default obfuscator will not cause any List
, Set
, Collection
or Map
to be obfuscated.
The following order is used to look up obfuscators for properties:
Like default obfuscators, it's also possible to define default character representation providers per type:
Module module = ObfuscationModule.builder()
.withDefaultCharacterRepresentation(Date.class, d -> formatDate(d))
.build();
mapper.registerModule(module);
The matching will be the same as for default obfuscators.
Like type-specific obfuscators, a type-specific character representation provider will also be used for any List
, Set
, Collection
or Map
property with a matching generic element/value type that is obfuscated during deserialization.
The following order is used to look up character representation providers for properties:
@RepresentedBy
on any array property just to prevent obfuscating values like [I@490d6c15
instead of [1, 2, 3]
.@ObfuscateFixedLength(3)
private Obfuscated<String> stringValue;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
@JsonSerialize(using = DateSerializer.class)
@JsonDeserialize(using = DateDeserializer.class)
@RepresentedBy(DateFormat.class)
private Obfuscated<Date> dateValue;
Assume that DateFormat formats Date objects as yyyy-MM-dd
, then this will obfuscate values like 1970-01-01
and not Thu Jan 01 00:00:00 GMT 1970
.
Note that the format, serializer and deserializer target Date
, not Obfuscated
.
@ObfuscateFixedLength(3)
private List<String> obfuscatedList;
Note that the annotation is needed; the following is not obfuscated (unless there is a default obfuscator for String
or one of its super types):
private List<String> regularList;
@ObfuscatePortion(keepAtStart = 8)
@RepresentedBy(DateFormat.class)
private List<Date> obfuscatedList;
Assume that DateFormat formats Date objects as yyyy-MM-dd
, then this will obfuscate the days, leaving values like 1970-01-**
.
FAQs
Provides support for serializing and deserializing obfuscated values using Jackson
We found that com.github.robtimus:obfuscation-jackson-databind demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.