Skip to content

slack.sh: Ensure existence of secret service#338

Open
siddhpant wants to merge 1 commit intoflathub:masterfrom
siddhpant:fix-no-keyring
Open

slack.sh: Ensure existence of secret service#338
siddhpant wants to merge 1 commit intoflathub:masterfrom
siddhpant:fix-no-keyring

Conversation

@siddhpant
Copy link

Slack stores its token in the keyring and reads from it at application start (in the same way as chromium).

We can have cases where the secret service does not exist at some point of time, because the keyring provider is another non-DE program, like keepassxc.

And this can especially happen on startup - both keepassxc and Slack would be startup applications, and there is no ordering enforced by (let's say) GNOME.

Keyring is available for access only when keepassxc gets started. So it must start earlier. But due to lack of ordering, Slack could start before keepassxc.

Since Slack won the race, it can't use the secret service (i.e. the keyring access would fail), and thus can't see the token.

When that happens, Slack resets the session. And even upon subsequent availability of the secret service, Slack does not restore the session, even after gaining access to the keyring / token - the destruction of the session is stored somewhere outside I think, so it disregards the token or does not attempt to connect using it.

So let's ensure the existence of the keyring before actually starting Slack.

Yes, this is kind of an upstream bug, but we can "fix" this up in our scripts.

Slack stores its token in the keyring and reads from it at application
start (in the same way as chromium).

We can have cases where the secret service does not exist at some point
of time, because the keyring provider is another non-DE program, like
keepassxc.

And this can especially happen on startup - both keepassxc and Slack
would be startup applications, and there is no ordering enforced by
(let's say) GNOME.

Keyring is available for access only when keepassxc gets started. So it
must start earlier. But due to lack of ordering, Slack could start
before keepassxc.

Since Slack won the race, it can't use the secret service (i.e. the
keyring access would fail), and thus can't see the token.

When that happens, Slack resets the session. And even upon subsequent
availability of the secret service, Slack does not restore the session,
even after gaining access to the keyring / token - the destruction of
the session is stored somewhere outside I think, so it disregards the
token or does not attempt to connect using it.

So let's ensure the existence of the keyring before actually starting
Slack.

Yes, this is kind of an upstream bug, but we can "fix" this up in our
scripts.

Signed-off-by: Siddh Raman Pant <25429745+siddhpant@users.noreply.github.com>
@flathubbot
Copy link
Contributor

🚧 Test build enqueued.

@flathubbot
Copy link
Contributor

🚧 Started test build.

@siddhpant
Copy link
Author

What I currently do to mitigate the startup race is to use a wrapper script which calls flatpak after a sleep of 5 seconds.

But I think it's better if we can just add it in here for a more general mitigation.

I am a noob to flatpak dev, so I did not test this though. Please let me know if I put this in the wrong place.

@flathubbot
Copy link
Contributor

🚧 Test build succeeded. To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/187956/com.slack.Slack.flatpakref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants