-
Notifications
You must be signed in to change notification settings - Fork 72
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
UnrecognizedPropertyException: Unrecognized field "Item" when using JacksonDatabase or SimpleDatabase #70
Comments
We're seeing the same issue on our side when using the JacksonDatabase. |
Hey @lordgreg Could you please confirm that you are using version 2.2.2? I suspect the reason for this is that CustomData has been defined as being empty in both Simple and Jackson (which copied Simple to some degree) - whereas DOM and JAXB don't care about elements they don't know about. It's interesting that this has not come up before. Could you please supply some kind of test file containing "safe" data so I can include it in a test for the fix. A fix will be made in 2.2.3. NB 2.2.3 provides in-memory protection of Strings for Jackson only and is from now on the very much the preferred implementation. The others will be dropped in V3. See #60 and #62. Thanks |
Likewise to the above - would you please supply a safe test file ... Thanks |
Hi @jorabin-sense , Yes, I am using the version 2.2.2: test-KeePassJava2.kdbx.zip File doesnt have entries, but does have the Fields: <CustomData>
<Item>
<Key>KPXC_RANDOM_SLUG</Key>
<Value>df59b2ef51126309416ff8b48ea69dfaa9f00c8699e4d0201da51aecf663d2edb697e5d733cf8fca2613c4d697f735181ca72e6ddd4f676e0e73cef9e655ac95abbcec5b9a7fc119e2932e56cc65c8b189af96861c2362f5abbec173dc8a11e0d02bdc7346361943ec6f88a5071ed197af851de0f52c7d9bf6ac1fc8952a85973a05f59a77765348db6c7ee97c1ecba2b22fb269c9d3bb978ef492994abfee6be48a0f963e82a9073d20392bbe2181da18bdb08e49fd8d194a77f96dbadfa185dc47f0084270a3995bc7c17112a02e58fa9493236eacf40f72e274e73f0189887c9707f26caeff9dccd83530a2f95e118b209cbd4c5b04cee48b329954</Value>
</Item>
<Item>
<Key>_LAST_MODIFIED</Key>
<Value>Wed Nov 6 13:53:33 2024 GMT</Value>
</Item>
<Item>
<Key>KPXC_DECRYPTION_TIME_PREFERENCE</Key>
<Value>1000</Value>
</Item>
</CustomData> This is easily reproducible if you just create a new KDBX in KeePassXC :). |
Thanks for looking into this @jorabin-sense, I can confirm, we're also using 2.2.2. test.kdbx.zip |
Hi folks, that is now fixed, and 2.2.3-SNAPSHOT is pushed to the sonatype repo see #60 for the coordinates. Please confirm this works for you. Be aware that the effect of this change is to ignore custom data ... ie. if you load and save the database then the saved database won't contain the custom data. |
Thanks so much @jorabin - I can confirm the 2.2.3-SNAPSHOT works for us. |
Hi. Sadly, we are now getting another Exception: Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "PreviousParentGroup" (class org.linguafranca.pwdb.kdbx.jackson.JacksonEntry), not marked as ignorable (13 known properties: "ForegroundColor", "Binary", "OverrideURL", "CustomIconUUID", "Times", "AutoType", "String", "IconID", "BackgroundColor", "Tags", "UUID", "History", "icon"])
at [Source: (GZIPInputStream); line: 6886, column: 73] (through reference chain: org.linguafranca.pwdb.kdbx.jackson.model.KeePassFile["Root"]->org.linguafranca.pwdb.kdbx.jackson.model.KeePassFile$Root["Group"]->org.linguafranca.pwdb.kdbx.jackson.JacksonGroup["Group"]->java.util.ArrayList[1]->org.linguafranca.pwdb.kdbx.jackson.JacksonGroup["Entry"]->java.util.ArrayList[31]->org.linguafranca.pwdb.kdbx.jackson.JacksonEntry["PreviousParentGroup"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:1153)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:2241)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1793)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1771)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:316)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:361)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:246)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:361)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:246)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.XmlDeserializationContext.readRootValue(XmlDeserializationContext.java:104)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4905)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3885)
at org.linguafranca.pwdb.kdbx.jackson.JacksonSerializableDatabase.load(JacksonSerializableDatabase.java:70)
at org.linguafranca.pwdb.kdbx.jackson.JacksonSerializableDatabase.load(JacksonSerializableDatabase.java:41)
at org.linguafranca.pwdb.kdbx.KdbxStreamFormat.load(KdbxStreamFormat.java:65)
at org.linguafranca.pwdb.kdbx.jackson.JacksonDatabase.load(JacksonDatabase.java:81)
at foo.bar.baz.keepass2helm.KeepassDb.<init>(KeepassDb.kt:16)
at foo.bar.baz.keepass2helm.Keepass2Helm.run(Keepass2Helm.kt:61)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:198)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:18)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:395)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:392)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:410)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:435)
at foo.bar.baz.keepass2helm.Keepass2HelmKt.main(Keepass2Helm.kt:81)
Suppressed: com.fasterxml.jackson.core.JsonParseException: pad block corrupted
|
Oh dear. The example file you sent before works OK, so this must be a different one? |
Correct. I will try to generate a new, reproducible KDBX. Thank you for your great support! |
On reflection, I think the problem is that neither Simple nor Jackson support the KDBX 4.1 file format (JAXB and DOM do because they have no fixed idea of the exact format of the file beyond Groups/Entries etc.). So, simply ignoring the content of CustomData doesn't go far enough. The changes listed in this note go further than that. I'm hoping it won't be too hard to make the adjustments, which would mean that the content of the file should remain intact on a read/write cycle ... ... as mentioned on previous occasions, I'm dropping support for Simple from release 3 on, it hasn't been maintained for a long time, so I will need to decide whether it's worth making this upgrade to the Simple implementation. Hoping that people will feel that using Jackson as a drop in replacement - if necessary - will suffice. |
I've made changes to fix this properly now, i.e. KDBX 4.1 file format now supported, hopefully. Should load and save the data intact. @lordgreg will you please check that this version of 2.2.3-SNAPSHOT which I pushed to sonatype snapshot repo moments ago works for you. Confirming that I didn't make any changes to Simple, other than what is mentioned above. i.e. that will remain not supporting 4.1 file format. |
Hi there @jorabin, I've updated the code, compiled and tested. All keepass Files that have been throwing errors, are now working! |
That sounds like a win! Will close issue on publication of 2.2.3 which hopefully will happen shortly. |
Hello, it seems that I have a similar issue with JacksonDatabase (I am using 2.2.3-SNAPSHOT)
Here the failing database: password: test |
Hi. Thanks for this. It looks like what is happening is that CustomData is missing from the content model of Entry. FWIW it's also missing from the content model of Group. I'll have a look at fixing this shortly. |
I corrected the content models and created a new version of 2.2.3-SNAPSHOT pushed to the Sonatype repo. @hugoo10 will you verify that tis fix works for you , please? thanks |
Thank you @jorabin it is now working with my 8 years old database 😃 |
Good to know we have caught up. Interesting (ish) that no one reported this bug before. Custom data a little used feature, possibly. |
Yes, I use it with keepass2Android, that may be the reason |
* develop: (37 commits) Update logback dependency Adding various missing properties to Jackson implementation only, see #70 Updating XSD to 4.1 Further fixes for issue #70 - adding CustomData to Entry and Group documentation tweaks to viewing XML update CHANGELOG.md Adding deploy skip to test and util ref #71 Fixes for #70 Fixes for issue #70 Addressing #71 revert anonymous type / inner class for Java 8 tweaks to property value Adding equals etc methods to AESKey Undo accidental rename of Entry#setProperty Some tweaks Clarifications of the discussion of property value protection Significant updates to PropertyyValue Explained the security technical choices in the README. it's going to work this time ...
Now released to Maven as 2.2.3 |
We have a kdbx encrypted with password, using KDBX db v2.x
Opening the file with
SimpleDatabase
:Opening with JacksonDatabase:
Jax and Dom work without the issue.
If I export the file as YAML and check the Object, i see there are 3:
This is probably something that came in with manipulating the DB with KeePassXC from here and here.
The text was updated successfully, but these errors were encountered: