linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Sonny Sasaka <sonnysasaka@chromium.org>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH BlueZ 0/3] Per-device option to enable/disable internal profiles
Date: Mon, 13 Jul 2020 15:59:12 -0700	[thread overview]
Message-ID: <CABBYNZ+FyGLMGJUNJLR=quBn0R=bzsYRBHwbe1xnhR4BsR6k_w@mail.gmail.com> (raw)
In-Reply-To: <CAOxioNkHgmycT=xoJp01GHQxL-0enVhWh9NsiQxqbDUCZ1Gj8g@mail.gmail.com>

Hi Sonny,

On Mon, Jul 13, 2020 at 3:04 PM Sonny Sasaka <sonnysasaka@chromium.org> wrote:
>
> Hi Luiz,
>
> I considered having such an approach that gives exception to some
> profile to not claim exclusive access. However, I think that this
> approach has a drawback that it can only be guaranteed to work
> correctly for profiles that contain only read-only attributes. Any
> profile that contains writable attributes, naturally, cannot be
> guaranteed to always work correctly (as is the case with the Battery
> profile). Therefore, the usefulness of that feature will be very
> limited.
>
> I also considered the benefits of the AllowInternalProfiles approach:
> * Applications can also have control over any profile, not just
> Battery profile. For example, if in the future BlueZ has more internal
> profiles, like (Blood Pressure Profile or any other profile that may
> contain writable attributes), we can guarantee that applications can
> still opt to have access to that profile, without relying on a profile
> being "safe" to be shared by both BlueZ's internal and external
> handlers.
> * This has an added security benefit: applications which operate on a
> specific GATT profile will not unintentionally activate internal
> profiles such as HOG (which is able to hijack input control of the
> host). This is the correct and expected behavior of Android apps that
> connect over GATT and get access to a GATT profile.

Not sure I follow these arguments, it seems AllowInternalProfiles may
actually enable hijacking the profiles so I wonder if you got this
backwards as we can't let things like HoG be controlled by
applications directly it would be too easy to implement something like
a keylogger, or perhaps you are suggesting that there is another layer
for implementing the profiles? Note that it is intended that plugins
shall be used for profiles that need to be integrated system wide,
D-Bus interface shall be restricted to only application specific
profiles.

Note that we do allow external profiles to be registered with use of:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/profile-api.txt

And for GATT:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt#n366

We could perhaps make the assumption that once an application
registers itself as supporting a given profile we check if against a
blacklist of profiles that may have security implications, which
perhaps could be defined via main.conf or some other file, if that is
not the case the internal profile can be disabled and the D-Bus object
would be accessible over D-Bus. Also note that we do offer clients the
ability to have exclusive access with AcquireWrite and AcquireNotify.

> Therefore I think that this approach, although more complex, has
> longer lasting benefits. Let me know if you have any objection to
> having such a feature.
>
>
> On Mon, Jul 13, 2020 at 1:35 PM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Sonny,
> >
> > On Mon, Jul 13, 2020 at 1:18 PM Sonny Sasaka <sonnysasaka@chromium.org> wrote:
> > >
> > > This patch series adds a mechanism for clients to choose whether to
> > > enable BlueZ internal profiles (e.g. A2DP, Battery) for specific
> > > devices.
> > >
> > > The motivation behind this feature is that some applications (e.g. Web
> > > Bluetooth or Android apps) need to have control over all remove GATT
> > > services, like Battery service. With "battery" plugin being enabled on
> > > BlueZ, it becomes not possible for those apps to work properly because
> > > BlueZ "hides" the Battery-related attributes from its GATT Client API.
> > > Disabling the "battery" plugin won't solve the problem either, since we
> > > do also need to enable the plugin so that we can use org.bluez.Battery1
> > > API.
> > >
> > > The solution that we propose is that clients can choose whether to
> > > enable internal profiles for each device. Clients know when to enable
> > > internal profiles (such as when a user chooses to pair/connect via a UI)
> > > and when to disable internal profiles (such as when the connection is
> > > initiated by a generic application).
> >
> > I wonder if it is not better to just have a flag indicating if the
> > profile shall claim exclusive access (such as GAP and GATT services),
> > so profiles that don't set that will have the services exposed so for
> > battery we can probably just have it exposed by default since it
> > doesn't appear to would be any conflicts on having it exposed.
> >
> > > Sonny Sasaka (3):
> > >   doc: Add "AllowInternalProfiles" property to org.bluez.Device1
> > >   device: Add "AllowInternalProfiles" property to org.bluez.Device1
> > >   client: Add set-allow-internal-profiles command
> > >
> > >  client/main.c      | 38 ++++++++++++++++++
> > >  doc/device-api.txt | 13 +++++++
> > >  src/device.c       | 96 ++++++++++++++++++++++++++++++++++++++++++++++
> > >  src/hcid.h         |  2 +
> > >  src/main.c         | 10 +++++
> > >  src/main.conf      |  4 ++
> > >  6 files changed, 163 insertions(+)
> > >
> > > --
> > > 2.26.2
> > >
> >
> >
> > --
> > Luiz Augusto von Dentz



-- 
Luiz Augusto von Dentz

  reply	other threads:[~2020-07-13 22:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 20:14 [PATCH BlueZ 0/3] Per-device option to enable/disable internal profiles Sonny Sasaka
2020-07-13 20:14 ` [PATCH BlueZ 1/3] doc: Add "AllowInternalProfiles" property to org.bluez.Device1 Sonny Sasaka
2020-07-13 20:14 ` [PATCH BlueZ 2/3] device: " Sonny Sasaka
2020-07-13 20:14 ` [PATCH BlueZ 3/3] client: Add set-allow-internal-profiles command Sonny Sasaka
2020-07-13 20:35 ` [PATCH BlueZ 0/3] Per-device option to enable/disable internal profiles Luiz Augusto von Dentz
2020-07-13 22:04   ` Sonny Sasaka
2020-07-13 22:59     ` Luiz Augusto von Dentz [this message]
2020-07-13 23:48       ` Sonny Sasaka
2020-07-14  5:28         ` Luiz Augusto von Dentz
2020-07-14 20:55           ` Sonny Sasaka
2020-07-15 16:25             ` Luiz Augusto von Dentz
2020-07-15 20:13               ` Sonny Sasaka
2020-07-15 21:08                 ` Luiz Augusto von Dentz
2020-07-15 22:29                   ` Sonny Sasaka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABBYNZ+FyGLMGJUNJLR=quBn0R=bzsYRBHwbe1xnhR4BsR6k_w@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sonnysasaka@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).