Use application name instead of pid when creating SNI dbus service
ClosedPublic

Authored by jgrulich on May 9 2017, 7:15 AM.

Details

Summary

This is required when using SNI in sandbox (e.g. in flatpak) where the pid starts from 1,
usually it is 2 (the first one is bwrap) and this can theoretically cause collision with
already registered services. Also with using app name instead of pid we know in advance
what the service name will look like and we can give the sandboxed app access to it, which
is not possible when using pid as the name is not known until the app is started.

Diff Detail

Repository
R289 KNotifications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jgrulich created this revision.May 9 2017, 7:15 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 9 2017, 7:15 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
mart accepted this revision.May 9 2017, 8:50 PM
mart added a subscriber: mart.
This comment was removed by mart.
This revision is now accepted and ready to land.May 9 2017, 8:50 PM
mart requested changes to this revision.May 9 2017, 8:51 PM

are we sure applicationname is unique? what about of multiple instances of the same application?

This revision now requires changes to proceed.May 9 2017, 8:51 PM
jgrulich updated this revision to Diff 14360.May 10 2017, 6:34 AM
jgrulich edited edge metadata.

Use applicationName() instead of applicationPid() only for sandboxed applications

This still doesn't make the service name unique, but at least there won't be collision between
instances running outside the sandbox. Unfortunately I can't think of anything else to use as
we need the dbus service name predictable so we can allow access to it for the sandboxed app.

jgrulich updated this revision to Diff 14361.May 10 2017, 6:36 AM

Remove my useless debug

mart accepted this revision.May 10 2017, 8:49 AM

definitely better!
i don't know whether we can afford to change it in any way outside the sanbox and not break things..
it may make sense to use applicationName-pid at least inside the sandbox, maybe outside as well if affordable?
(so you would have applicationName-1 applicationName-2 etc in the sandbox which still make sense

This revision is now accepted and ready to land.May 10 2017, 8:49 AM

Using applicationName-pid you cannot guarantee the pid will be always 1 or 2, you can have e.g a special launcher for an app doing some stuff and then you end up with much higher pid.

This revision was automatically updated to reflect the committed changes.