After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786811 - Crash on startup in secret_service_search_cb()
Crash on startup in secret_service_search_cb()
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Sync
3.25.x
Other Linux
: Normal critical
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-25 18:01 UTC by Michael Catanzaro
Modified: 2017-08-25 21:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
password-manager: Don't try to set timestamp if missing (1.40 KB, patch)
2017-08-25 18:02 UTC, Michael Catanzaro
none Details | Review
password-manager: Handle invalid input from gnome-keyring (10.67 KB, patch)
2017-08-25 20:57 UTC, Gabriel Ivașcu
reviewed Details | Review
password-manager: Handle invalid input from gnome-keyring (10.70 KB, patch)
2017-08-25 21:05 UTC, Gabriel Ivașcu
none Details | Review
password-manager: Handle invalid input from gnome-keyring (1.52 KB, patch)
2017-08-25 21:27 UTC, Gabriel Ivașcu
committed Details | Review

Description Michael Catanzaro 2017-08-25 18:01:33 UTC
Epiphany is crashing for me in startup in secret_service_search_cb() in ephy-password-manager.c. Right here:

sscanf (timestamp, "%lf", &server_time_modified);

Problem is timestamp can be NULL there. This patch fixes it by not trying to set the timestamp, but I don't know if it's right.

  • #0 rawmemchr
    from /lib64/libc.so.6
  • #1 _IO_str_init_static_internal
    from /lib64/libc.so.6
  • #2 __isoc99_vsscanf
    from /lib64/libc.so.6
  • #3 __isoc99_sscanf
    from /lib64/libc.so.6
  • #4 secret_service_search_cb
    at ../../../../Projects/GNOME/epiphany/lib/sync/ephy-password-manager.c line 549
  • #5 g_simple_async_result_complete
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gsimpleasyncresult.c line 801
  • #6 on_search_secrets
    at /home/mcatanzaro/Projects/GNOME/libsecret/libsecret/secret-methods.c line 98
  • #7 g_simple_async_result_complete
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gsimpleasyncresult.c line 801
  • #8 on_get_secrets_complete
    at /home/mcatanzaro/Projects/GNOME/libsecret/libsecret/secret-item.c line 1378
  • #9 g_task_return_now
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1145
  • #10 g_task_return
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1203
  • #11 g_task_return_pointer
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1601
  • #12 reply_cb
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gdbusproxy.c line 2589
  • #13 g_task_return_now
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1145
  • #14 g_task_return
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1203
  • #15 g_task_return_pointer
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1601
  • #16 g_dbus_connection_call_done
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gdbusconnection.c line 5722
  • #17 g_task_return_now
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1145
  • #18 complete_in_idle_cb
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gtask.c line 1159
  • #19 g_idle_dispatch
    at /home/mcatanzaro/Projects/GNOME/glib/glib/gmain.c line 5504
  • #20 g_main_dispatch
    at /home/mcatanzaro/Projects/GNOME/glib/glib/gmain.c line 3148
  • #21 g_main_context_dispatch
    at /home/mcatanzaro/Projects/GNOME/glib/glib/gmain.c line 3813
  • #22 g_main_context_iterate
    at /home/mcatanzaro/Projects/GNOME/glib/glib/gmain.c line 3886
  • #23 g_main_context_iteration
    at /home/mcatanzaro/Projects/GNOME/glib/glib/gmain.c line 3947
  • #24 g_application_run
    at /home/mcatanzaro/Projects/GNOME/glib/gio/gapplication.c line 2401
  • #25 main
    at ../../../../Projects/GNOME/epiphany/src/ephy-main.c line 432

Comment 1 Michael Catanzaro 2017-08-25 18:02:12 UTC
Created attachment 358438 [details] [review]
password-manager: Don't try to set timestamp if missing
Comment 2 Michael Catanzaro 2017-08-25 18:35:47 UTC
(In reply to Michael Catanzaro from comment #0)
> Problem is timestamp can be NULL there.

Wrong, it's actually the string "0"
Comment 3 Gabriel Ivașcu 2017-08-25 20:57:57 UTC
Created attachment 358449 [details] [review]
password-manager: Handle invalid input from gnome-keyring

Although unlikely, gnome-keyring data may get broken or corrupted
for whatever reason. EphyPasswordManager should not crash in that
case though, but rather handle it by trying to fix the corrupted
records if possible or delete them if not.
Comment 4 Gabriel Ivașcu 2017-08-25 21:05:48 UTC
Created attachment 358450 [details] [review]
password-manager: Handle invalid input from gnome-keyring

Although unlikely, gnome-keyring data may get broken or corrupted
for whatever reason. EphyPasswordManager should not crash in that
case though, but rather handle it by trying to fix the corrupted
records if possible or delete them if not.


Forgot to unref original if it cannot be fixed.
Comment 5 Michael Catanzaro 2017-08-25 21:07:32 UTC
Review of attachment 358449 [details] [review]:

Hm, thanks for working on this. I think I would favor a simpler approach.

::: lib/sync/ephy-password-manager.c
@@ +58,2 @@
 static void ephy_synchronizable_manager_iface_init (EphySynchronizableManagerInterface *iface);
+static void ephy_password_manager_forget_record (EphyPasswordManager *self,

If the record is corrupted, I would leave it be rather than deleting it. There may be salvageable information. E.g. if the origin is somehow corrupted, the password might still be there. Or vice-versa, so it would at least be possible for the user to know which passwords have been lost.

Of course both of these cases are extremely unlikely, and not really worth bothering about, but I'm trying to make an argument for doing nothing rather than deleting the records.

@@ +566,3 @@
+
+    if (!hostname || !password_field) {
+      /* Unfixable corrupted record. Delete it. */

So here I would rather do nothing. g_free (original) as you noticed on IRC that you're missing, and then goto next.

@@ +574,2 @@
+    if (!id || !target_origin || !timestamp) {
+      /* Fixable corrupted record. Replace the original. */

Hm, this is a lot of extra code to try fixing records that we know are unlikely to become corrupted. I would remove all of this. All we need to do is not crash. So what I would do is if (!hostname || !password_field || !id || !target_origin || !timestamp), goto next.

Also, and this is important as it's very confusing: I failed to notice earlier in my previous code review that we're storing security origins in variables named hostname. I'll file another bug for this.
Comment 6 Gabriel Ivașcu 2017-08-25 21:27:45 UTC
Created attachment 358451 [details] [review]
password-manager: Handle invalid input from gnome-keyring

Although unlikely, gnome-keyring data may get broken or corrupted
for whatever reason. Epiphany should not crash in that case.


According to comment 5: Just skip corrupted records, don't attempt to fix them or delete them.
Comment 7 Michael Catanzaro 2017-08-25 21:29:36 UTC
Comment on attachment 358451 [details] [review]
password-manager: Handle invalid input from gnome-keyring

Isn't that nicer!
Comment 8 Gabriel Ivașcu 2017-08-25 21:31:25 UTC
Attachment 358451 [details] pushed as 3980ca9 - password-manager: Handle invalid input from gnome-keyring