Skip to content

Flatpak can falsely think a deploy is a downgrade when a remote's collection ID changes. #1477

Open

Description

@mwleeds

Even when collection IDs are used, flatpak stores refs in refs/remotes not refs/mirrors. This can lead to problems when a remote's collection ID changes (which happens for example in Endless with eos-stage-flatpak which switches from production to staging or vice versa).

Let's say I have a remote called appserver that provides a ref called app, with the collection ID com.appserver.Staging or com.appserver.Prod depending on which repo is used. If I have the (com.appserver.Staging, app) installed which has timestamp A and I switch the remote to prod and try to update to (com.appserver.Prod, app) which has timestamp B, and A is newer than B, flatpak will think the operation is a downgrade, which is not the case.

Activity

  1. mwleeds commented on Mar 12, 2018

    @mwleeds
    ContributorAuthor

    A few more thoughts:

    • This isn't very different from how it works without collection IDs (the timestamp of the existing ref is checked as long as the remote name matches regardless of whether the URL matches)
    • @rshuler pointed out that in many cases this behavior is reasonable because you usually want to update to a newer commit even when you're switching from dev to prod or vice versa
    • For P2P code the ostree-metadata ref becomes important, and in that case you do want to "downgrade" because really it's an entirely different ref. For this reason, I'm considering if flatpak should be doing more mirror pulls which would avoid this. The only case where this would make a downgrade attack possible (that is, a peer maliciously serving you an old ref) is if you (a) don't have any version or an old version of that ref by default and (b) only have access to malicious sources (peers), which is only very slightly worse than the status quo (because you're more likely to start out with some ostree-metadata than both the staging and prod versions).
  2. mwleeds commented on Apr 30, 2018

    @mwleeds
    ContributorAuthor

    The ostree-metadata case is handled by endlessm/eos-meta@d3f61cc

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions