DavidVentura / Keepass

Ubuntu touch keepass app
Other
2 stars 5 forks source link

Cannot open any database with saved favicons #33

Open JamiKettunen opened 1 year ago

JamiKettunen commented 1 year ago

This happens on a Fairphone 4 with latest Ubuntu Touch 20.04 Development channel build & v1.0.6 of the app from OpenStore.

The provided test.kdbx opens just fine though, so it appears that should be expanded with more advanced features to exercise more of the backend libaries.

As even journalctl --user -f appears to contain some potentially sensitive info I'll try to get a minimal reproducible example with a dummy database .kdbx (after bisecting what exactly in my database file causes this to happen), but for now here's something that might help already:

Removed as below is a much more useful output without anything "sensitive"
JamiKettunen commented 1 year ago

Ok @DavidVentura interestingly enough this appears to come down to the favicons I've saved in the .kdbx for various sites, will dig deeper.

JamiKettunen commented 1 year ago

Yeah simply having any site favicons at all will crash the loading logic it appears, steps to reproduce:

  1. Download https://github.com/DavidVentura/Keepass/blob/master/test.kdbx & open it with KeePassXC on a desktop
  2. Right click the demo github entry and select Download Favicon
  3. On-device: sudo sed '/^Exec=/ s/qmlscene/env RUST_BACKTRACE=full qmlscene/' -i /opt/click.ubuntu.com/keepass.davidv.dev/current/Keepass.desktop
  4. Attempt to open the database on an Ubuntu Touch (20.04) phone with this app
  5. See something like this in journalctl --user -f output soon after tapping Open DB:
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field Generator
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field DatabaseName
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field DatabaseNameChanged
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field DatabaseDescription
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field DatabaseDescriptionChanged
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field DefaultUserName
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field DefaultUserNameChanged
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field MaintenanceHistoryDays
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field Color
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field MasterKeyChanged
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field MasterKeyChangeRec
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field MasterKeyChangeForce
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled field CustomIcons
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: thread '<unnamed>' panicked at 'Found a non-text child item when parsing Element(Element { prefix: None, namespace: None, namespaces: None, name: "Icon", attributes: {}, children: [Element(Element { prefix: None, namespace: None, namespaces: None, name: "UUID", attributes: {}, children: [Text("JP9gMfuwTISmYPmnkyqx1Q==")] }), Element(Element { prefix: None, namespace: None, namespaces: None, name: "Data", attributes: {}, children: [Text("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAEnRFWHRfcV9pY29PcmlnRGVwdGgAMzLV4rjsAAAEl0lEQVRYha1XUWhbVRj+vnPTNNvaSNnuTZpkJY4ryJ1uD3UrIjL3Ioo6fRLZ08CHKjIRHfowWJbpFHzQiUN9EB8F6YNlKMM5GRsozjnRDqpgkNgmze1Nts60KW2a5PdhyXaX3LTZmu8p5//P/3/fOffk/88hOoRlWf65QmGvAPsgYgGICBkBAIrMAJgBOUng1MCWLecmJyfLneTlWhPiuh5eIhMish9AsEO9RZJfBkSS6XzevisBpmn2LhSLhwG8LiKbOiS+PTlZAvBBXzB4PJVKLXcsoL7qcREZuRtiDyEXAyLPee1Gi4CYYeyoiHwrQKwb5C6ijI98KuM4E20FxHU9vARc6ja5W0QA2OXeCdX4YZpm7xI57iYn8CeBr0hevQu+6wTGCPzWMAgQWyLHTdPsbRGwUCwebv7mJE/Y+fwL91tWGEq9CNKuOxZAXiFwgcB5kBMA/qvHXCNwcLOuh+x8/nmSx905RWSkfrgbi7x56FLN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0fgfUk/VbnmdnBIAAAAASUVORK5CYII=")] })] }) - Element { prefix: None, namespace: None, namespaces: None, name: "CustomIcons", attributes: {}, children: [Element(Element { prefix: None, namespace: None, namespaces: None, name: "Icon", attributes: {}, children: [Element(Element { prefix: None, namespace: None, namespaces: None, name: "UUID", attributes: {}, children: [Text("JP9gMfuwTISmYPmnkyqx1Q==")] }), Element(Element { prefix: None, namespace: None, namespaces: None, name: "Data", attributes: {}, children: [Text("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAEnRFWHRfcV9pY29PcmlnRGVwdGgAMzLV4rjsAAAEl0lEQVRYha1XUWhbVRj+vnPTNNvaSNnuTZpkJY4ryJ1uD3UrIjL3Ioo6fRLZ08CHKjIRHfowWJbpFHzQiUN9EB8F6YNlKMM5GRsozjnRDqpgkNgmze1Nts60KW2a5PdhyXaX3LTZmu8p5//P/3/fOffk/88hOoRlWf65QmGvAPsgYgGICBkBAIrMAJgBOUng1MCWLecmJyfLneTlWhPiuh5eIhMish9AsEO9RZJfBkSS6XzevisBpmn2LhSLhwG8LiKbOiS+PTlZAvBBXzB4PJVKLXcsoL7qcREZuRtiDyEXAyLPee1Gi4CYYeyoiHwrQKwb5C6ijI98KuM4E20FxHU9vARc6ja5W0QA2OXeCdX4YZpm7xI57iYn8CeBr0hevQu+6wTGCPzWMAgQWyLHTdPsbRGwUCwebv7mJE/Y+fwL91tWGEq9CNKuOxZAXiFwgcB5kBMA/qvHXCNwcLOuh+x8/nmSx905RWSkfrgbi7x56FLNp52attu27UuNsaXrfdc0bWh0dPSvZDJZa0rMWCx2n6Zp+ampqbmGPRQK3Yta7Z+mhZUCImY6n7cJAGHD+FREXmreQ+XzPZTL5S577W+nGBwcHKpVKv8220l+ZjvOy8qyLH+9yLSiWrXWQw4AIrK9jX2/ZVl+NVco7IVHhSNZgqZdWK8ATdN+IVnwcAXnCoW9SoB9bWKP5XK5lq27U2Sz2asQedPLJ8A+VW8sLfD5/V+vl7yBwKZN3rlELAUg0mwnWZqenk51S0A6nb5OcsrDFVGNltoEh6R0SwAAQGS2xURGFF3F6NZc2dJVcgAgW3ISUAqA1wntD4VCRre44/F4AB6fGkBeAfC8MCiRx7slYHlxcY+I9Hq4bEWRn72CRORVEVnzxtQJBHjNy06Riwrk+TZBuwZDoTfWSx7W9QMi8oSnkzyvggMD3wOY9xQh8n7YMI4NDw/33ClxIpFQYcM4JMDnbabMD4icaTSjkyLySl3Vhxr5a1XkLYjsAAAC0yC/UMCPyu+/nMlkrnll3LZt2z2lUmlYAQ/XRA5AxGwnkEqdtGdnDyoA8ImcIFkGAN4IzG8WeQTk7wAgwFYRSVRFzqyUy6cSiUTLXxcAFufnx1Gr/VCr1d5ZlZxc7hE5UV/cDYQNIykiR+rDos/v305yQ6Vc/sldFzSlnp2ZnT3llTgcDj8m1eq5dsQuAUnbcY4CriLUFwy+W7/ZAECwWi4nM5nM3wGRB0keAvCRIkc39vd/1y6xz+ebaOdzsU/0BYPv3Ry6fZFIZGt1ZeUigEEAVWraM7Ztn14zqQshXV8B4Gvjzmk9PSMzMzPTngIAIGoYOysip2+KIM8COEtgXoDQo3v2HB8bG6uuIqACQPMi95FPZh3nD7fRs9BEo9FYZWXlG4jsbPZt1vXe1d59IV2vorm/kFeUpj2dy+VaOqLnac5ms5n+YHCEZJLkbU+qxcVFzxg33S1elkm+vWHjxt1e5G0FAEAqlVq2HedoD7CdSn0MoAhyIR6PV1ZlJ+dALpD8xOf3P2A7zpF0Or20hui1Yel639DQ0MBa86LRaMw0zU5f0fgfUk/VbnmdnBIAAAAASUVORK5CYII=")] })] })] }', /root/.cargo/git/checkouts/keepass-rs-8774402bf56cacdf/68161e6/src/xml_parse.rs:477:9
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: stack backtrace:
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    0:       0x7f7cdaca3c - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    1:       0x7f7cdc5904 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    2:       0x7f7cdaa6e8 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    3:       0x7f7cdae134 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    4:       0x7f7cdade48 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    5:       0x7f7cdae7bc - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    6:       0x7f7cdae6a4 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    7:       0x7f7cdacf08 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    8:       0x7f7cdae3f0 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:    9:       0x7f7cd209b8 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   10:       0x7f7cd472bc - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   11:       0x7f7cd4eef4 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   12:       0x7f7cd29a1c - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   13:       0x7f7cd218c8 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   14:       0x7f7cd26444 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   15:       0x7f7cd28750 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   16:       0x7f7cd23e20 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   17:       0x7f8511ceb4 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   18:       0x7f8511d350 - _PyObject_MakeTpCall
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   19:       0x7f84efd72c - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   20:       0x7f84efecb0 - _PyEval_EvalFrameDefault
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   21:       0x7f84f07724 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   22:       0x7f8511d008 - PyVectorcall_Call
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   23:       0x7f8c9c8230 - _ZN11QPythonPriv4callEP7_object7QString8QVariantPS3_
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   24:       0x7f8c9b93c0 - _ZN7QPython13call_internalE8QVariantS0_b
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   25:       0x7f8c9c4b64 - _ZN13QPythonWorker7processE8QVariantS0_P8QJSValue
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   26:       0x7f8c9cb330 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   27:       0x7f9602d280 - _ZN7QObject5eventEP6QEvent
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   28:       0x7f96e6c3ac - _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   29:       0x7f96e759b0 - _ZN12QApplication6notifyEP7QObjectP6QEvent
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   30:       0x7f95ffe98c - _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   31:       0x7f960018a0 - _ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   32:       0x7f9605b990 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   33:       0x7f94f4a944 - g_main_context_dispatch
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   34:       0x7f94f4abb4 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   35:       0x7f94f4ac54 - g_main_context_iteration
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   36:       0x7f9605ae3c - _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   37:       0x7f95ffd138 - _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   38:       0x7f95e33dc0 - _ZN7QThread4execEv
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   39:       0x7f95e354b8 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   40:       0x7f95798624 - start_thread
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   41:       0x7f95a6049c - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   42:                0x0 - <unknown>
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: "PyOtherSide error: Traceback (most recent call last):\n\n  File \"/opt/click.ubuntu.com/keepass.davidv.dev/1.0.6/src/kp.py\", line 58, in open_db\n    META, GROUPS, ENTRIES = get_meta_and_entries(db_path, password=password or None, keyfile=key_path or None)\n\nSystemError: Rust panic\n"
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: Unhandled PyOtherSide error: Return value of PyObject call is NULL: Traceback (most recent call last):
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:   File "/opt/click.ubuntu.com/keepass.davidv.dev/1.0.6/src/kp.py", line 58, in open_db
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]:     META, GROUPS, ENTRIES = get_meta_and_entries(db_path, password=password or None, keyfile=key_path or None)
    Feb 27 00:47:58 ubuntu-phablet aa-exec[9080]: SystemError: Rust panic

    Hope this helps to get the issue solved :)

DavidVentura commented 1 year ago

thanks for debugging, do you think you can try and reproduce this with the upstream version? you'll need to have a rust dev setup for it https://github.com/sseemayer/keepass-rs is the project, and generates some debugging binaries to open/dump databases in your local machine

if that works, i'll see when i can update to upstream

JamiKettunen commented 1 year ago

Based on the commit (68161e6) visible in the logs above I tested https://github.com/DavidVentura/libkeepass-rs/commits/next but even that appears to dump the database (cargo run --release --features "utilities" --bin kp-dump-xml -- test.kdbx) just fine which breaks the UT app, so I'm guessing the culprit is https://github.com/DavidVentura/pykeepass-rs?