Skip to content

[snap] migration from strict to classic enclosure #116

Closed as not planned
Closed as not planned

Description

@shiftkey

There's some outstanding problems with our use of the strict enclosure for the Snap installer:

Essentially, a Snap in a strict enclosure is not able to launch any processes outside it sandbox. This affects some of the important integration for Desktop, such as being able to launch your configured editor or shell.

After talking it over with various Snap team members there appears to be no easy solution for this, other than switching enclosures. But that in itself is a really hard problem, because there's no way to upgrade a package which changes it's enclosure setting from strict to classic (which is basically unrestricted). This is why we've temporarily disabled the listing on the Snap store to prevent more people installing this app and then facing this problem: #108

The solution we have figured out is a bit rough, but looks like this (paraphrasing an earlier discussion with @flexiondotorg about this):

Preparations

This Week

  • ✅ Friday 29th March

Next Week

At this point existing users of the edge channel will receive the update and see the notification to transition manually to the beta channel.

Post-Migration

  • allow time for edge installs to migrate themselves over to beta
  • at some point, publish a version on edge that uses the classic enclosure
  • cleanup the Snap migration warning once a sufficient % of users have migrated

Activity

  1. added
    installers/snap
    on Jan 17, 2019
  2. shiftkey commented on Feb 7, 2019

    @shiftkey
    OwnerAuthor
    • Make a request for GitHub Desktop to be approved to use classic confinement (I believe this is underway)

    @flexiondotorg is there anything I can do to move this along? All the subsequent work is not possible currently...

  3. shiftkey commented on Mar 27, 2019

    @shiftkey
    OwnerAuthor

    I've refreshed the issue body to reflect the current state of affairs, and hopefully on Friday I can start the migration process.

  4. flexiondotorg commented on Mar 27, 2019

    @flexiondotorg

    @shiftkey Looks like you've got everything covered in the sequence of events.

  5. shiftkey commented on Mar 29, 2019

    @shiftkey
    OwnerAuthor

    This is on hold at the moment because the package gets rejected on publish with this message:

    Error while processing...
    The store was unable to accept this snap.
       - confinement 'classic' not allowed with plugs/slots
    

    This is the new config we are using to build the snap, and I'm not sure at a glance what I should be changing in here:

    snap:
    confinement: 'classic'
    stagePackages:
    - default
    - libcurl3
    - openssh-client
    - gettext
    environment:
    DISABLE_WAYLAND: 1

    I'll see if I can troubleshoot more over the weekend...

    EDIT: should be addressed with 2af83f5

    EDIT 2: ugh, now it's a different error

    Error while processing...
    The store was unable to accept this snap.
       - confinement 'classic' not allowed with plugs/slots
       - invalid plugs entry (empty)
    

    EDIT 3: I've isolated the issue to electron-userland/electron-builder#2730 which linked off to a workaround about manually editing snap.yaml and repackaging the app, which was done in 0ca1184. Then I needed to refresh my access token to support beta publishing, so hopefully -linux6 is the lucky one.

    EDIT 4: we have a working beta version, aiming to do some testing this week and confirm it's working as expected..

  6. shiftkey commented on Apr 1, 2019

    @shiftkey
    OwnerAuthor

    Did a quick test pass of the first run and integrations with the latest beta and everything looks fine. I opened #134 to track the protocol handler integration, as the earlier work in #110 to support this with the .deb package is not relevant here.

  7. shiftkey commented on Apr 1, 2019

    @shiftkey
    OwnerAuthor

    Pausing this because my earlier idea to "just spawn snap" here worked in development but not in the strict enclosure after publishing to edge:

    const result = spawnSync('snap', ['list', 'github-desktop'])
    if (result.error != null) {
    resolve(false)
    return
    }

    I have an idea to read process.execPath which will give me:

    • whether this is a published snap
    • the version embedded in the path

    I can whitelist versions that we've published to beta to ignore part of this check, which can be obtained by running snapcraft revisions --arch amd64 github-desktop. I don't plan to publish the same build to multiple channels during this transition period, so I think this is fine.

  8. shiftkey commented on Apr 5, 2019

    @shiftkey
    OwnerAuthor

    After poking at available information for beta and edge channels I noticed a predictable differentiator between the two environments: in the strict enclosure the --disable-gpu-compositing flag is passed into the renderer process:

    I haven't been able to find the relevant part of the toolchain that's responsible for this, but it seems a pretty reliable indicator of the environment, rather than hard-coding versions which aren't known until they're published to the store.

    EDIT: this was a red herring, and not something controlled by the channel - likely Electron itself detecting GPU compositing was disabled at the time (power saving)? Oh well, the snap-strict-enclosure branch is not intending to be merged back into the main branch here, so the original naive patch can remain.

  9. pinned this issue on Apr 7, 2019
  10. changed the title [-]migration process from strict to classic enclosure[/-] [+][snap] migration process from strict to classic enclosure[/+] on Apr 7, 2019
  11. changed the title [-][snap] migration process from strict to classic enclosure[/-] [+][snap] migration from strict to classic enclosure[/+] on Apr 7, 2019
  12. shiftkey commented on Apr 7, 2019

    @shiftkey
    OwnerAuthor

    I've tested out the edge upgrade warning the user and asking the user to change to the beta channel, so I've now made the snap public again and updated the related issues with notes about the migration process.

    I'm going to let this issue sit a bit and monitor for feedback.

  13. flexiondotorg commented on Apr 7, 2019

    @flexiondotorg

    Thanks for working on this. I'll be installing it when I get home 👍😀

  14. shiftkey commented on May 30, 2019

    @shiftkey
    OwnerAuthor

    It's been almost 2 months since I did the cutover to beta and published the dialog about getting people to migrate from edge to beta. We had almost 400 installs at the time:

    Screen Shot 2019-05-30 at 3 39 39 PM

    Fast-forward to today and we still have 300+ active installs of edge:

    I was really hoping that this number would be much lower, as I'd love to start exploring using edge as a preview channel for things like Electron upgrades and experimentation. But I can't do that if users are ignoring the warning and still running the wrong enclosure.

    A few ideas to make this more aggressive and see if it helps move people off edge:

    • make the wording more explicit about what the user needs to do
    • show the dialog every 30mins (or hour) while the app is running, rather than just on launch
    • show the dialog but then close the app when it's dismissed to essentially bomb the app
  15. flexiondotorg commented on May 31, 2019

    @flexiondotorg

    It seems a more heavy handed approach is indeed required. Anything we can do to help?

  16. shiftkey commented on May 31, 2019

    @shiftkey
    OwnerAuthor

    @flexiondotorg not really, just gearing up for another release next week but I guess that's gonna skip Edge 🤷‍♂

  17. zypA13510 commented on Jun 26, 2019

    @zypA13510

    It's been almost 2 months since I did the cutover to beta and published the dialog about getting people to migrate from edge to beta. We had almost 400 installs at the time:

    Fast-forward to today and we still have 300+ active installs of edge:

    I was really hoping that this number would be much lower, as I'd love to start exploring using edge as a preview channel for things like Electron upgrades and experimentation. But I can't do that if users are ignoring the warning and still running the wrong enclosure.

    How do you count active installs?
    Because coming to this repository today to install it on a new system, I come to realize that I had an old install that hasn't been used for at least 3 months, but the system is regularly maintained. If these were counted then I think it's probably normal?

  18. shiftkey commented on Jun 26, 2019

    @shiftkey
    OwnerAuthor

    @zypA13510

    How do you count active installs?

    This is a question for the Snapcraft team. I can't answer this.

  19. NatoBoram commented on Jul 9, 2019

    @NatoBoram

    Hello! I just upgraded to the beta channel on a fresh Ubuntu 19.04 install following the prompt and I can't launch it anymore.

    Segmentation fault (core dumped)

    I think it may explain why some users aren't switching.

  20. immackay commented on Jul 9, 2019

    @immackay

    @NatoBoram, I am under the impression that there is an issue with the 2.1.0 release (snap version 63).

    Can you downgrade to version 62? I believe there is no issues with it.

    If you don't have version 62 cached, you can download it from the release assets here, and install it with

    snap remove github-desktop
    snap install GitHubDesktop-linux-2.0.4-linux1.snap --classic --dangerous
    

    See #163 for more information

  21. hackel commented on Nov 30, 2019

    @hackel

    You need to remove (or make optional) the requirement to run this with classic confinement. As far as I'm concerned, this defeats the whole point of using Snap. If I didn't want confinement, I would just install the .deb package. I am not installing some random code from Microsoft of all people with unconfined access to my system! I understand that this currently brings with it several limitations, but that's better than opening up my entire system to random code from the internet.

    Eventually I'm sure snapd will have a proper interface for running external editors or whatever the issue is that motivated this change.

  22. zypA13510 commented on Dec 1, 2019

    @zypA13510

    You need to remove (or make optional) the requirement to run this with classic confinement.

    I can think of one way to make this optional - build another snap that's under strict confinement and publish it via a different name, e.g. github-desktop-confined. However, I'm not sure this is worth the effort, see my points below.

    As far as I'm concerned, this defeats the whole point of using Snap. If I didn't want confinement, I would just install the .deb package.

    Yes, I agree that using snap without confinement is somewhat pointless, save for the auto-update. But, if you didn't want a GitHub Desktop with shell, editor and file explorer integration, what are you using GitHub Desktop for? View git tree? gitk --all can do just that (and more, like cherry-picking or tagging). Stage files for commit? Atom or whatever IDE you use will probably have that built-in or provided via a plugin. As far as I'm concerned, GitHub Desktop is more about integrating the workflow, and if those integration features are all missing, this defeats the whole point of using GitHub Desktop.

    I am not installing some random code from Microsoft of all people with unconfined access to my system! I understand that this currently brings with it several limitations, but that's better than opening up my entire system to random code from the internet.

    It's not some random code, it's code in this repository that you can review or even build yourself. This is open-source, if you so desire, you can fork it and switch it back to strict confinement, build, install, and use it. No-one will keep you from doing that. The question is, should we build broken snap by default, what do most users expect?

    And it's not just GitHub Desktop, vscode, atom, webstorm, sublime, android-studio they all do this, all of them requires classic confinement to function properly.

    And if you don't trust the source, the best and only solution is to not run it. Would you run an email attachment from an unknown sender, even if in strict snap confinement? Would you run malware in a VM? Who knows it won't utilize some privilege-escalation vulnerability and break out of jail? At some point, you have to trust something.

    Eventually I'm sure snapd will have a proper interface for running external editors or whatever the issue is that motivated this change

    That would be great and eventually we can switch back to strict confinement without this discussion.

  23. unpinned this issue on Mar 30, 2020
  24. shiftkey commented on Apr 4, 2020

    @shiftkey
    OwnerAuthor

    Just bumping this issue to indicate the package is unlisted on the Snapcraft store due to various issues and I have no timeline for restoring Snap support. #202 is tracking that work, and I'm blocked on doing any sort of local building or testing of snaps.

  25. shiftkey commented on Apr 21, 2022

    @shiftkey
    OwnerAuthor

    Closing this out as I don't have the bandwidth to revisit this in the short or medium term. If someone else wants to have a shot at this I've added notes in #202 which are from the last time I thought about Snap packaging...

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

    infrastructureinstallers/snap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions