this post was submitted on 13 Mar 2022
31 points (94.3% liked)

Open Source

30260 readers
319 users here now

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

Rules

Related Communities

Community icon from opensource.org, but we are not affiliated with them.

founded 5 years ago
MODERATORS
 

I often see people talking about the fact that they like a certain open-source application, but 'it's a shame it's on Electron'; what does this mean? Is it a privacy thing or a resource thing?

top 34 comments
sorted by: hot top controversial new old
[–] Echedenyan@lemmy.ml 29 points 2 years ago* (last edited 2 years ago)

Electron is a framework for desktop development based on Chromium.

It has a big part of Chromium as part of its code but with a wrapper layer to act as a framework.

With it, you can make desktop apps with PWA (Progressive Web Apps).

They like some of it because you can get the beauty of CSS and JS effects in a desktop app, but for every of these apps you end running an independent instance of Chromium.

It doesn't use system browser engine or one from the installed browsers. Every app you install using it is exactly the same as installing Chrome or Chromium in different folders at your PC and running them at the same time.

This is why they blame it too.

[–] AgreeableLandscape@lemmygrad.ml 28 points 2 years ago* (last edited 2 years ago)

Privacy wise: It uses Chromium, which has been shown to have plenty of phone homes back to Google. Even though it's open source, even projects specifically intended to "de-Google" it, like the Ungoogled Chromium project, are adamant that they're never sure that they've gotten all of it because it's so pervasive -- and Electron uses the vanilla Chromium code straight from Google.

Other than that, the other, bigger reason is that Electron is extremely inefficient. @dessalines@lemmy.ml mentioned an Electron chat app using 4GB of RAM, and that's not an exaggeration. You can easily get multi-GB RAM usage on even simple Electron apps. It uses a lot of CPU power too, like when Visual Studio Code used 13% of a CPU just to make the cursor blink.

Basically, almost anything is a better app platform than Electron. A fully native app in a low-level language is obviously the standard for performance, but even if you don't want to go through the trouble, languages like Java and Kotlin are still way better than Electron. Hell, even other interpreted languages like Python run circles around Electron, see Blender.

[–] MrGamingHimself@lemmy.ml 24 points 2 years ago (2 children)

Electron apps is essentially running web apps wrapped as a desktop version. Most of them run like garbage and are always inferior to one made specifically for desktops. The only one I've used that runs sensibly is Discord.

As for why people use it, it's convenient for developers as most of them are familiar with web development and can essentially copy-paste their web application without having to change much.

[–] xarvos@lemmy.ml 11 points 2 years ago (1 children)

Electron apps is essentially running web apps wrapped as a desktop version.

worse even: it includes different copies of chromium in each app

[–] Helix@feddit.de 3 points 2 years ago

Yeah, and since the devs obviously are either too inept to change this or don't care, they probably never will – this "idea about a runtime mode" issue is open since 2014.

2014 was the same year Microsoft ended support for Windows XP.

[–] cooper@lemmy.ml 2 points 2 years ago (2 children)

So, I assume there’s not an Electron alternative that is able to port internet desktop applications without any privacy or resource issues?

[–] MrGamingHimself@lemmy.ml 9 points 2 years ago

There isn't an alternative, Electron actually does its job well for what it is. It's basically a slimmed down browser that's customizable and runs on all systems, it's just that it takes a ton of effort to optimize it, and for some reason most people using it aren't very experienced.

[–] nachtigall@feddit.de 6 points 2 years ago

There is Tauri which is very similar but claims to have a lower resource usage and be more secure.

[–] jokeyrhyme@lemmy.ml 16 points 2 years ago (2 children)

People complain about Electron, but without it there would probably be even fewer cross-platform apps today

Some aspects of it might be less than perfect, but let's not allow perfect to be the enemy of good

Electron doesn't automatically mean that an app is bad, just like Unity doesn't automatically mean that a game is good

[–] yogthos@lemmy.ml 11 points 2 years ago (1 children)

Completely agree, thanks to Electron we now have many mainstream apps working on Linux and that just wouldn't have happened otherwise. Whatever technological problems Electron has can be addressed down the road, and are outweighed by the value of lowering the barrier of creating cross-platform applications.

[–] AgreeableLandscape@lemmygrad.ml 13 points 2 years ago (2 children)

I'd be less hateful of Electron if it simply allowed me to use Mozilla Gecko instead of Chromium as the rendering engine.

[–] IngrownMink4@lemmy.ml 6 points 2 years ago

You mean something similar to XULRunner?

[–] yogthos@lemmy.ml 4 points 2 years ago

Pluggable engines would be nice, but I feel like it's less of a concern for stuff like Electron where you're making apps with it. I'd be more interested in addressing memory usage and cutting out stuff that's not really needed for apps that's part of the browser engine. Ideally, it should be modular so that you can include just the stuff your app uses to keep it lean. Perhaps using an approach similar to GraalVM could be taken as well to reduce resource usage.

[–] Helix@feddit.de 4 points 2 years ago

Or you could just use the offline functionality built into browsers nowadays instead of Electron.

[–] Voxelous@lemmy.ml 12 points 2 years ago (3 children)

Here are some flaws with Electron:

  • High RAM and CPU consumption since it's based on Chromium
  • Electron apps take too much space as they're bundled with NodeJS and Chromium runtine
  • Electron apps tend to be slow
  • Terrible sucurity
[–] cooper@lemmy.ml 7 points 2 years ago

Ahhh, I see; so, essentially, a combination of both resources and privacy.

[–] jokeyrhyme@lemmy.ml 6 points 2 years ago* (last edited 2 years ago) (1 children)

An Electron app has full access to your filesystem and to other system resources, the same as any other desktop app

Is there a specific reason or example for why we say it has terrible security here?

Chromium has an incredibly advanced and optimised graphics pipeline and the code that is running in the "web" part of an Electron app benefits from Chromium's sandbox

[–] AgreeableLandscape@lemmygrad.ml 6 points 2 years ago* (last edited 2 years ago) (1 children)

Is there a specific reason or example for why we say it has terrible security here?

From what I've heard, it's trivial to accidentally execute an external webapp with the same privileges as the app itself, so you're one bug away from potentially giving a random website access to your system APIs. For example, an improperly implemented HTML previewer would probably be the easiest way to get pwned in this way, especially since Electron supports the entire Node.js environment and not just browser based JS.

[–] jokeyrhyme@lemmy.ml -1 points 2 years ago (1 children)

You mean how like nobody ever ever pipes the output of curl into a bash with root privileges? :P

Maybe we should ban cURL when we ban Electron?

[–] AgreeableLandscape@lemmygrad.ml 8 points 2 years ago* (last edited 2 years ago) (1 children)

No, this is worse. With the cURL thing, you know what you're doing because you literally entered the command, and then you have to enter a password, and you can make your own assessment as to whether it's a good idea. Also, assuming you're on an HTTPS connection and trust the source (i.e. reputable software author versus shady pirate site), it's not actually unsafe.

Whereas with sandbox breaks in Electron, someone can't reasonably know that a feature is vulrnable (hell it can take the people who wrote the damn thing years to realize there's a bug). If you need to open an HTML file in VSCode, are you going to manually audit the previewer implementation? It's much easier to check your terminal commands for insecure pipes than to check an electron app for sandbox violations.

[–] jokeyrhyme@lemmy.ml 1 points 2 years ago (1 children)

I guess a better parallel is using C/C++ to write software, where it is trivially easy to mismanaged memory in ways that cause 70% of CVEs

If we were being consistent, we'd be trying to eliminate all software written in any language or framework where it is trivially easy to introduce security issues

I wonder how many anti-Electron folks are also logically anti-C/C++ ?

[–] AgreeableLandscape@lemmygrad.ml 1 points 2 years ago

I'm definitely an advocate for low level memory safe languages like Rust, over C/C++

[–] cooper@lemmy.ml 4 points 2 years ago
[–] IngrownMink4@lemmy.ml 11 points 2 years ago
[–] triplenadir@lemmygrad.ml 10 points 2 years ago (1 children)

If you have to use more than one Electron app, Ferdi is pretty great https://getferdi.com/

[–] SrEstegosaurio@lemmy.ml 2 points 2 years ago (1 children)

Thank you for pointing this out. Atm I only use Discord (bc my friends "lIkE tHiR UI" and refuse to use mumble...) bit if I had to go through the pain of using more electron crap I think that that app would be a cool solution

[–] triplenadir@lemmygrad.ml 3 points 2 years ago* (last edited 2 years ago) (1 children)

I haven't tried it yet, but Fosscord seems like it could be handy for Discord rehab treatment (especially if the incredible-sounding "connect to discord.com servers" works)

[–] iortega@lemmy.eus 2 points 2 years ago

I didn't know it was already usable. Thanks

[–] SrEstegosaurio@lemmy.ml 7 points 2 years ago (2 children)

Well, electron just sucks. Is just trash. Inmense resource consumption bc chromium.

[–] dessalines@lemmy.ml 22 points 2 years ago (2 children)

I always like to think of the fact that space agencies went to the moon on like 2KB of ram, but in 2022 we need 4 GB of ram to run a chat window.

[–] AgreeableLandscape@lemmygrad.ml 10 points 2 years ago

I always liked the saying "just because I have the RAM doesn't mean it's for you!"

[–] SrEstegosaurio@lemmy.ml 7 points 2 years ago (1 children)

"But nowdays is cheaper" it's a lazy excuse to not do any proper optimization.

[–] dessalines@lemmy.ml 7 points 2 years ago

That article that @IngrownMink4@lemmy.ml linked is so good. At the bottom of it, they state: "All you web devs should learn C or Rust. Your program runs on a computer. Learn how to code for one."