Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
2.2.0
-
None
Description
The code inside isSoftReferenced method in AtlasStructDef class below:
}} {{@JsonIgnore
public boolean isSoftReferenced() {
return this.options != null && }}{{ getOptions().containsKey(AtlasAttributeDef.ATTRDEF_OPTION_SOFT_REFERENCE) &&
getOptions().get(AtlasAttributeDef.ATTRDEF_OPTION_SOFT_REFERENCE).equals(STRING_TRUE);
{{ }}}
Since the null check is not performed, it can lead to NPE in typedef resolution.
A sample typedef payload like the following can potentially trigger the NPE error in attribute resolution, i.e. EntityGraphRetriever.mapVertexToAttribute, where attribute.getAttributeDef().isSoftReferenced() is called
{
"businessMetadataDefs": [
{
"category": "BUSINESS_METADATA",
"name": "bizType1",
"description": "test",
"attributeDefs": [
{
"name": "bizAttr1",
"typeName": "string",
"isOptional": true,
"cardinality": "SINGLE",
"options":
{ *"isSoftReference": null,* "maxStrLength": "50", "applicableEntityTypes": "[\"Asset\"]" }
}
]
}
]
}
It would be furthermore helpful to run SonarCube or FindBugs to determine any other incidences where this pattern of missing null check exists in Atlas codebase and address them.