We're trying to migrate from SnakeYAML to jackson-dataformat-yaml, but there's one thing that's currently stopping us. We parse YAML documents and allow our users to mark fields as sensitive, so that they're handled in a safe way. For example:
modules:
- name: foo
parameters:
username: someone
password: !sensitive Abcd1234
Note that the value of the password field is marked with a custom YAML tag - !sensitive.
We handle this custom tag with the following code:
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.nodes.Tag;
public class YamlTaggedObjectsConstructor extends SafeConstructor {
private static final String SENSITIVE_TAG = "!sensitive";
public YamlTaggedObjectsConstructor() {
this.yamlConstructors.put(new Tag(SENSITIVE_TAG), new SecureConstruct());
}
}
Where SecureConstruct is our custom implementation of org.yaml.snakeyaml.constructor.AbstractConstruct that knows how to parse values marked with !sensitive.
Is there any chance you plan to add support for deserializers for custom tags or are they something you consider out-of-scope?
We're trying to migrate from SnakeYAML to
jackson-dataformat-yaml, but there's one thing that's currently stopping us. We parse YAML documents and allow our users to mark fields as sensitive, so that they're handled in a safe way. For example:Note that the value of the
passwordfield is marked with a custom YAML tag -!sensitive.We handle this custom tag with the following code:
Where
SecureConstructis our custom implementation of org.yaml.snakeyaml.constructor.AbstractConstruct that knows how to parse values marked with!sensitive.Is there any chance you plan to add support for deserializers for custom tags or are they something you consider out-of-scope?