Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle possible security problem with ObjectNode, HashMap, String.hashCode() #37

Closed
cowtowncoder opened this issue Jul 26, 2012 · 1 comment

Comments

@cowtowncoder
Copy link
Member

(see [https://github.com/FasterXML/jackson-core/issues/21] for related problem)

Given that it is easy to fabricate collisions for String.hashCode() (since JDK's impl allows substring-replacement style attacks very easily), ObjectNode is prone to attacks.
Since JsonParser use has been fixed (Issue-21), it is necessary to simialrly address the issue of use of HashMap with default String hashCode().

The big problem here is the performance: not so much that of cost of calculating hashCode() alone, but lack of caching of that value (JDK aggressively caches hashCode on first access).

We should probably do similar two-part solution here as earlier: make it possible to detect abnormal (super high collision list) cases and error out; but also improve hash code used as much as possible.

@cowtowncoder
Copy link
Member Author

I think latest JDK 7 and 8 versions use work-around for case of HashMap / HashSet (wish I had a link at hand), so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant