Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Contributors

Contributors

References

2018-10-03 AAI Meeting Notes

...

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyAAI-628

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyAAI-907

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyAAI-908

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyAAI-910

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyAAI-928

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyAAI-1218

Jackson Replacement

Security subcommittee has recommended teams move away from jackson, and will be presenting alternatives and asking for an assessment from each project. Our team will need to do an analysis - this would not be trivial, especially given how many of our repos are impacted. As of now, this would be a very high LOE for the team, we need to understand what the recommendation from the SECCOM is before we can provide better details on what the LOE would be.

Survey of Replacement Options

Articles with comparisons and benchmarks:

Articles above link to about 20 libraries as options to be explored, including:

Quick CVE comparison:

Code Analysis

Search on AAI source code shows:

...

FasterXML Jackson versionGoogle gson versionComments
Code Block
mapper = new ObjectMapper();
Code Block
JsonParser parser = new JsonParser();

Code Block
JsonNode rootNode = mapper.readTree(new File(authFilename));
JsonNode rolesNode = rootNode.path(AuthConstants.ROLES_NODE_PATH);
Code Block
JsonObject authObject = parser.parse(authFile).getAsJsonObject();
JsonArray roles = authObject.getAsJsonArray("roles");

Jackson's JsonNode is a more abstract data structure, compared with Gson's more concrete data structures JsonObject and JsonArray.

Code Block
String function = functionNode.path(AuthConstants.FUNCTION_NAME_PATH).asText();
Code Block
String roleName = roleObject.get("name").getAsString();
Code structure differs at this point (function name vs role name) but the general intent of the code is equivalent (get the element name as a string).
Code Block
public synchronized void loadUsers(String authFilename) throws Exception


(no exception handling in this method)
Code Block
} catch (JsonProcessingException e) {
			ErrorLogHelper.logError("AAI_4001", globalAuthFileName + ". Not valid JSON: " + e);

For some reason, this version still catches com.fasterxml.jackson.core.JsonProcessingException even though it uses Google gson for parsing.

Not a good idea to defer exception handling to the caller since the caller has no idea why/how/when/where the parsing failed and might be left with an invalid data structure as well.

Code Block
boolean hasMethods = handleMethodNode(methodsNode, role, function);
Code Block
usrs.forEach((key, value) -> {
...
});
Method call vs Java lambda call is not really relevant to the Jackson replacement, but consistency of style could be an overall goal if the code is being re-factored anyway.

Suggestions

...

.

...

links to benchmark in comments: https://github.com/fabienrenaud/java-json-benchmark

which links to about 20 libraries as options to be explored, including:

Quick CVE comparison:

...

POC: Replacing default Spring Boot Jackson dependencies with Gson - Tian Lee

...