Skip to content

Commit

Permalink
DQ-165: Prevent user YAML override
Browse files Browse the repository at this point in the history
  • Loading branch information
bichitra95 committed Aug 5, 2024
1 parent e50cc62 commit 0cb18dd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ private void processCreateContract(AtlasEntity entity, EntityMutationContext con

boolean contractSync = syncContractCertificateStatus(entity, contract);
contractString = DataContract.serialize(contract);
entity.setAttribute(ATTR_CONTRACT, contractString);
if (!isContractYaml(entity)) {
entity.setAttribute(ATTR_CONTRACT, contractString);
}
String contractStringJSON = DataContract.serializeJSON(contract);
entity.setAttribute(ATTR_CONTRACT_JSON, contractStringJSON);

Expand Down Expand Up @@ -298,4 +300,8 @@ private static String getContractString(AtlasEntity entity) {
}
return contractString;
}

private static boolean isContractYaml(AtlasEntity entity) {
return !StringUtils.isEmpty((String) entity.getAttribute(ATTR_CONTRACT));
}
}

0 comments on commit 0cb18dd

Please sign in to comment.