Skip to content

Authentication is required to install ostree-metadata from flathub #2328

Closed

Description

@mwleeds

Do we want the user to authenticate just to download metadata? That seems to be the case currently:

screenshot from 2018-11-15 17-02-20

Activity

  1. matthiasclasen commented on Nov 16, 2018

    @matthiasclasen
    Collaborator

    Ha! Putting the details in the ui reveals the nonsense

  2. kalev commented on Nov 23, 2018

    @kalev
    Contributor

    Is this popping up because gnome-software is downloading the metadata in the background?

    Should gnome-software do something differently? Like, check that it has permissions to download metadata with g_permission_get_allowed() and if not, not do automatic updates?

  3. matthiasclasen commented on Nov 23, 2018

    @matthiasclasen
    Collaborator

    Automatic updates can only work if all the involved steps don't require authentication.
    We may need some api to query this, or some flag to indicate it

  4. mwleeds commented on Nov 30, 2018

    @mwleeds
    ContributorAuthor

    For the record this turned out to be caused by /usr/share/polkit-1/rules.d/org.freedesktop.Flatpak.rules having subject.isInGroup("wheel") rather than subject.isInGroup("sudo"), which presumably was caused by me compiling flatpak incorrectly. The above commit just moves the operation to a different polkit action but isn't strictly necessary if the default set of policy and rules are being used.

  5. kalev commented on Dec 1, 2018

    @kalev
    Contributor

    Fair enough, but how about regular users who aren't in wheel/sudo? Should gnome-software do something differently there to not spam them with metadata updating polkit prompts?

  6. matthiasclasen commented on Dec 1, 2018

    @matthiasclasen
    Collaborator

    @kalev if we want to support some sort of locked-down use case where the system installation is entirely readonly for users, then yes, g-s should not trigger those dialogs for background operations. Maybe this can be done by providing some 'allow-interactive' or 'background' flag to the system helper. I think we've done this sort of hint in other places before ?

  7. kalev commented on Dec 1, 2018

    @kalev
    Contributor

    I'm thinking that polkit prompts popping up out of nowhere is bad user experience regardless of whether it's a locked down account or a regular user.

    Maybe gnome-software should just skip doing background updates if it can't do it without acquiring polkit permissions? I think it's already possible to check this with g_permission_get_allowed() without adding new API.

    packagekit has a "background" concept, but there "background" means something else, that the background tasks get cancelled as soon as a non-background (user initiated) task comes in.

  8. matthiasclasen commented on Dec 1, 2018

    @matthiasclasen
    Collaborator

    See #2367

    This adds a 'no-interaction' flag to FlatpakInstallation and FlatpakTransaction, and passes it through to the system helper (as far as possible, some methods unfortunately don't take flags).

    With this, gnome-software can just set no-interaction when doing background tasks, and quietly handle a NOT_ALLOWED error (need to double-check exactly what error you'll get).

  9. kalev commented on Dec 1, 2018

    @kalev
    Contributor

    Ooh, awesome!

  10. matthiasclasen commented on Dec 1, 2018

    @matthiasclasen
    Collaborator

    some open questions:

    • what name is better, BACKGROUND or no_interaction ? currently its a mix, for the worst of both worlds
    • should we use the opportunity to add flags to all system helper methods ?
  11. matthiasclasen commented on Dec 2, 2018

    @matthiasclasen
    Collaborator

    I answered the first question myself, by renaming it all to no_interaction, and I made a separate PR for adding flags

  12. kalev commented on Dec 3, 2018

    @kalev
    Contributor

    no_interaction sounds great to me!

    Is there a way for gnome-software to tell if something got skipped due to no_interaction? Would it be possible to have a new error code, so that gnome-software knows that the operation didn't go through due to no_interaction?

  13. matthiasclasen commented on Dec 3, 2018

    @matthiasclasen
    Collaborator

    Looking at the code, the system-helper returns GIO_DBUS_ERROR_ACCESS_DENIED in this case (the same as if the user mistyped his password), which should bubble up all the way.

  14. kalev commented on Dec 3, 2018

    @kalev
    Contributor

    That should work. Right now gnome-software shows a helpful "Unable to download updates: you do not have permission to install software" when it gets that error, but I think we can improve on that and just ignore it :)

  15. matthiasclasen commented on Dec 3, 2018

    @matthiasclasen
    Collaborator

    Quitly accepting defeat would be the right thing to do, in the no-interaction case. I can add getters for the no-interaction flag on the transaction and installation objects, if that makes it easier to differentiate.

  16. kalev commented on Dec 3, 2018

    @kalev
    Contributor

    Yeah, maybe that would be good if it's easy to do. I think gnome-software can handle keeping the no-interaction state on its own too, but it's possible it makes it easier in certain places, and it sounds like an easy thing to expose in libflatpak.

  17. matthiasclasen commented on Dec 3, 2018

    @matthiasclasen
    Collaborator

    The PR now has flatpak_installation_[sg]et_no_interaction. I decided that we can do without a setter in the transaction, since you can just operate on the underlying installation.

  18. ramcq commented on Dec 4, 2018

    @ramcq
    Contributor

    I don't get the reasoning here, if we just make these noninteractive but don't change the PolKit logic / make a different action / something, we're "downgrading" the upgrade privelege to be basically useless unless you have the install privelege, because any upgrade op will also need to install metadata, and potentially new runtimes. That's inconsistent with our current defaults (non-priveleged users can upgrade but not install) and renders the two verbs useless/indivisible. So these changes are good (the noninteractive stuff) but we have more underlying issues to tackle:

    1. I think we need to have a different (more permissable) action that covers metadata updates - moving it to "modify-repo" makes it worse because it's easy to imagine a system where the admin wants to control the remotes but is happy to allow users to install or upgrade from those remotes. Defining/modifying repos is "more priveleged" than install, not less.
    2. We need to be able to figure out how to apply the upgrade perms to an install op that takes place as a part of an upgrade transaction.

    (if upgrading is our "least priveleged" op we could attach all metadata fetches/updates to that)

  19. matthiasclasen commented on Dec 4, 2018

    @matthiasclasen
    Collaborator

    basically, the reasoning is:

    • the desired experience for background operations is that they happen in the background, without interrupting the user
    • if the polkit policy does not let us implement that (by insisting on interaction), we can't do background operations, so we don't

    you're right that we should work on the policy to make them possible.
    but currently, the operations arrive at the system-helper one-by-one, there's nothing to differentiate a install-due-to-an-update from an install-at-will.

  20. matthiasclasen commented on Dec 4, 2018

    @matthiasclasen
    Collaborator

    Defining/modifying repos is "more priveleged" than install, not less.

    I agree with this. So here are some suggestions:

    • Add a separate metadata-update action
    • Make all-update imply runtime-install and runtime-update, policy-wise
  21. matthiasclasen commented on Dec 4, 2018

    @matthiasclasen
    Collaborator

    See #2383 for these changes

  22. mwleeds commented on Dec 4, 2018

    @mwleeds
    ContributorAuthor

    I think we need to have a different (more permissable) action that covers metadata updates - moving it to "modify-repo" makes it worse because it's easy to imagine a system where the admin wants to control the remotes but is happy to allow users to install or upgrade from those remotes. Defining/modifying repos is "more priveleged" than install, not less.

    modify-repo is not the action used for adding new remotes or modifying existing ones. That happens under configure-remote.

  23. matthiasclasen commented on Dec 4, 2018

    @matthiasclasen
    Collaborator

    And see #2384 for another batch of polkit changes that gets us to the ideal of '1 transaction, (at most) 1 dialog'

  24. kalev commented on Dec 4, 2018

    @kalev
    Contributor

    Awesome stuff :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions