keemobile / kotpass

The library offers reading and writing support for KeePass (KDBX) files in Kotlin
MIT License
17 stars 0 forks source link

Invalid entry field without id #10

Closed Bendejo21 closed 7 months ago

Bendejo21 commented 11 months ago

Hallo,

when trying to unlock my kdbx file there is no access: Message "Invalid entry field without id".

Thanks.

KotpassDatabase$Companion(17) : app.keemobile.kotpass.errors.FormatError$InvalidXml: Invalid entry field without id. at app.keemobile.kotpass.xml.EntryKt.unmarshalField(Entry.kt:105) at app.keemobile.kotpass.xml.EntryKt.access$unmarshalField(Entry.kt:1) at app.keemobile.kotpass.xml.EntryKt.unmarshalEntry(Entry.kt:61) at app.keemobile.kotpass.xml.GroupKt.unmarshalGroup(Group.kt:78) at app.keemobile.kotpass.xml.DefaultXmlContentParser.unmarshalContent(DefaultXmlContentParser.kt:38) at app.keemobile.kotpass.database.DecoderKt.decode(Decoder.kt:96) at app.keemobile.kotpass.database.DecoderKt.decode$default(Decoder.kt:25) at com.ivanovsky.passnotes.data.repository.keepass.kotpass.KotpassDatabase$Companion.open(KotpassDatabase.kt:464) at com.ivanovsky.passnotes.data.repository.keepass.KeepassDatabaseRepository.openDatabase(KeepassDatabaseRepository.kt:196) at com.ivanovsky.passnotes.data.repository.keepass.KeepassDatabaseRepository.open(KeepassDatabaseRepository.kt:61) at com.ivanovsky.passnotes.domain.interactor.unlock.UnlockInteractor$openDatabase$2.invokeSuspend(UnlockInteractor.kt:111) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Anvell commented 11 months ago

Hello,

this error means that some entry has a custom field but it's name (key) wasn't specified. By format convention every custom field is required to have unique name. There is no way you can get this error after saving file with clients like KeePassXC, KeeWeb or KeeMobile. So, technically kotpass tells you that you have malformed content. Which client did you use?

I've took a look at KeePassXC source and they also would not allow such data with error: Entry string key or value missing.

I think fastest solution in your case would be to open this file in source client and locate this unnamed custom field.

Bendejo21 commented 11 months ago

Thank you for your explanation. I use kpassnotes on grapheneos, I think the database will be lost because there is no known way to modify. Thank you very much.

Anvell commented 7 months ago

Hello, new kotpass version is more lenient and tolerates such entries. You can restore your files using KeeMobile 1.17.0+ by opening and making some change to re-save the database with sanitized entries.

Anvell commented 7 months ago

Fixed by #13