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 784944 - Be robust against org.freedesktop.secrets crashes and restarts
Be robust against org.freedesktop.secrets crashes and restarts
Status: RESOLVED OBSOLETE
Product: gnome-online-accounts
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-07-14 10:21 UTC by Debarshi Ray
Modified: 2021-07-05 10:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
imap-smtp, smtp-auth: Remove unused code paths (15.23 KB, patch)
2017-07-14 11:02 UTC, Debarshi Ray
committed Details | Review
imap-auth-login, imap-smtp: Remove unused code paths (10.06 KB, patch)
2017-07-14 11:15 UTC, Debarshi Ray
committed Details | Review
provider: Clean up the public header (4.77 KB, patch)
2017-07-14 11:31 UTC, Debarshi Ray
committed Details | Review
provider: Clean up the public header (3.44 KB, patch)
2017-07-14 13:04 UTC, Debarshi Ray
committed Details | Review
kerberos: Create the account only after the initial sign in (9.73 KB, patch)
2017-07-17 15:47 UTC, Debarshi Ray
none Details | Review

Description Debarshi Ray 2017-07-14 10:21:48 UTC
Libsecret's caching of the SecretService proxy object (bug 765406) prevents it from being robust against the org.freedesktop.secrets service crashing or getting restarted (eg., bug 764029). While it might be possible to fix the underlying problem in libsecret (I have doubts about it), I'd like to workaround it in gnome-online-accounts by caching our own SecretService and avoiding the secret_password* APIs.
Comment 1 Debarshi Ray 2017-07-14 11:02:12 UTC
Created attachment 355582 [details] [review]
imap-smtp, smtp-auth: Remove unused code paths
Comment 2 Debarshi Ray 2017-07-14 11:15:27 UTC
Created attachment 355584 [details] [review]
imap-auth-login, imap-smtp: Remove unused code paths
Comment 3 Debarshi Ray 2017-07-14 11:31:50 UTC
Created attachment 355587 [details] [review]
provider: Clean up the public header
Comment 4 Debarshi Ray 2017-07-14 13:04:17 UTC
Created attachment 355596 [details] [review]
provider: Clean up the public header
Comment 5 Debarshi Ray 2017-07-14 16:15:13 UTC
Work-in-progress patches at:
gnome-online-accounts:wip/rishi/libsecret-workaround
Comment 6 Debarshi Ray 2017-07-17 15:47:08 UTC
Created attachment 355763 [details] [review]
kerberos: Create the account only after the initial sign in
Comment 7 Ray Strode [halfline] 2017-07-17 17:11:48 UTC
Review of attachment 355763 [details] [review]:

So I guess proof is in the pudding if it works!

One thing I wonder about...the identify service notices when a user manually runs kinit and creates a temporary account.  Changing the order here, where you sign in first before creating the account seems like it has the potential to exercise that kinit-temporary-account-creating code path.  Do you think goaidentityservice.c:on_account_added is failing and we don't notice since failure isn't logged?  If so, probably harmless, but might make since to put a comment or something.  what about the other way, could identity service win the race the account gets stuck as a temporary account ?

::: src/goabackend/goakerberosprovider.c
@@ +1211,3 @@
+  /* FIXME: we go to great lengths to keep the password in non-pageable memory,
+   * and then just duplicate it into a gvariant here
+   */

probably should just delete this fixme. it's not true really and we're probably not going to fix it anytime soon.
Comment 8 Debarshi Ray 2017-07-17 17:45:15 UTC
(In reply to Ray Strode [halfline] from comment #7)
> Review of attachment 355763 [details] [review] [review]:
> One thing I wonder about...the identify service notices when a user manually
> runs kinit and creates a temporary account.  Changing the order here, where
> you sign in first before creating the account seems like it has the
> potential to exercise that kinit-temporary-account-creating code path.  Do
> you think goaidentityservice.c:on_account_added is failing and we don't
> notice since failure isn't logged?  If so, probably harmless, but might make
> since to put a comment or something.  what about the other way, could
> identity service win the race the account gets stuck as a temporary account ?

I'll take another look. My initial reading of the code didn't raise any red flags, and both the GUI and kinit seem to work as expected.

> ::: src/goabackend/goakerberosprovider.c
> @@ +1211,3 @@
> +  /* FIXME: we go to great lengths to keep the password in non-pageable
> memory,
> +   * and then just duplicate it into a gvariant here
> +   */
> 
> probably should just delete this fixme. it's not true really and we're
> probably not going to fix it anytime soon.

Ok.
Comment 9 Debarshi Ray 2017-07-24 17:38:47 UTC
(In reply to Ray Strode [halfline] from comment #7)
> Review of attachment 355763 [details] [review] [review]:
> One thing I wonder about...the identify service notices when a user manually
> runs kinit and creates a temporary account.  Changing the order here, where
> you sign in first before creating the account seems like it has the
> potential to exercise that kinit-temporary-account-creating code path.  Do
> you think goaidentityservice.c:on_account_added is failing and we don't
> notice since failure isn't logged?

Yes, you are right. It is not failing, but losing the race with GoaKerberosProvider::add_account because we schedule a refresh only after the polling timeout.

> If so, probably harmless, but might make
> since to put a comment or something.  what about the other way, could
> identity service win the race the account gets stuck as a temporary account ?

Yes, it could win the race if we use a cache-type with notification support, or if we are right on the edge of the timeout.

I wonder if we should add some freeze/thaw call to org.gnome.Identity to skip a particular principal from being added as temporary. The pending_temporary_account_results hash table can be abused to implement it.

We could also emit a signal from org.gnome.Identity and move the temporary account creation into goa-daemon. That would reduce the circular dependency between goa-daemon and goa-identity-service a bit. However, that will be more complicated because GoaKerberosProvider::add_account doesn't happen in goa-daemon, but in the UI process (eg., gnome-control-center). So we'd need to convey the freeze/thaw between the UI and goa-daemon.

This attempt at being robust against org.freedesktop.secrets crashes/restarts is beginning to feel like shaving a yak. :)
Comment 10 GNOME Infrastructure Team 2021-07-05 10:58:26 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/

Thank you for your understanding and your help.