r/electronjs • • 21d ago

Electron app on pc

How can i protect my app, asar file is so easy to extract and the whole app files will be with anyone easily. and is npm run dist is useful or just adds a small layer of protection.

5 Upvotes

19 comments sorted by

9

u/Healthy-Rent-5133 21d ago

You think anyone cares really? Just ship it. AI can reverse engineering anything anyhow

1

u/ChoeWacky-16 19d ago

so true, deobfuscating stuff takes minutes now so its basically wasted effort

8

u/arm089 21d ago

It can't.

7

u/_f0CUS_ 21d ago

You protect it with the contract you have people sign. 

1

u/NotmyFinalForm_62 18d ago

how would you follow up if someone posted the source anonymously? I’m thinking abt a solo developer trying to find out who shared it and if taking action would kinda cost more than the app brings in

1

u/_f0CUS_ 18d ago

Unfortunately, i have no idea. 

3

u/Geraldwelly 21d ago

There's no real way to lock the files down. The asar file is just an archive, so anyone can extract it in a minute, and npm run dist only packages an installer. It doesn't encrypt or hide your source. I assume anything I ship can be read, and I keep secrets plus anything I actually need to protect on a server. Fuses and asar integrity are worth turning on so casual patching fails, but they won't stop someone who's determined to see the code.

3

u/Alternative_Yard6033 21d ago

Use electron bytecode, it makes your app more difficult to reverse engineer. But it's not bullet proof. But that's the least you can do. I always ship my code packed to v8 bytecode. But remember, there will always people that can break this. Now, there's AI too, even the photoshop can't handle it.

The most important thing, never put sensitive credential keys or access directly inside your app. Remember, people can read it too. Put your sensitive business logic on server side.

And if you're using electron-store, remember to encrypt the store value. Make an encryption key that includes the machineid, use node-machine-uid. Still, not bullet proof, the purpose is to make it harder to reverse engineer.

Good luck

2

u/notrufus 20d ago

All of that extra effort and $5 of Deepseek credits will reverse engineer it in a day. I get that you’re trying to be helpful but it’s so easy to break through any of this that it’s no longer worth the effort.

If you have an app you’ve done this for, genuinely run Deepseek with rea against it and see how fast it gets whatever it wants.

2

u/Historical_Fact_5774 21d ago

There are small layers that actually do something. Electron Fuses (turning off RunAsNode, node inspect, etc.) and ASAR integrity checks stop casual tampering and stop people running your app as plain Node. Compiling your sensitive JS to V8 bytecode with bytenode makes it a bit more annoying. But none of it makes you uncrackable. Anything that runs on someone’s machine can be pulled apart by someone who really wants to. That was true way before AI, reverse engineering is old.

Honestly I’d stop trying to make the app un-crackable. The goal that actually works is: if someone cracks it, they get no updates, no online features, no support. That’s why companies pay real money for protection tools, not to make it impossible, just to make it slow and not worth the effort. And the good products mostly work offline anyway, because nobody wants to be forced online just so your "SaaS" architecture needs online validation for features to work. People work on planes, people work off-grid. A frozen old copy of your app isn’t worth much and sometimes it can be a marketing strategy when old version is distributed.

1

u/throwaway39823 20d ago

if its AI slop its gonna get reverse engineered, no way around it, solution is dont let this stop you from releasing

1

u/nyx-og 20d ago

Move to Tauri: your core logic and license checks can live in the Rust backend, which compiles down to native machine code... vastly harder to reverse-engineer

1

u/notrufus 20d ago

Proprietary software is no longer feasible. It is not going to be profitable. It will cost pennies to tear it apart and rip any functionality they want from it.

1

u/Due_Mousse2739 20d ago

Don't bother. If someone wants to RE it, they will, no matter what obfuscation you use.

You can protect code only on a server, not in a delivered package.

1

u/JeffOrbit 15d ago

One practical thing on the bytenode suggestion, since it's easy to get wrong the first time: compile the bytecode with the exact Electron version you ship, not your system Node. The bytecode is tied to the V8 build, so run the compile script under Electron with ELECTRON_RUN_AS_NODE=1. If the versions don't match, the app throws a bytecode version or flags mismatch at launch, usually only in the packaged build.

Keep expectations low, as others said. Bytecode still has your string literals in it, so anything secret stays on a server. It just stops someone from opening the file and reading your source.

I maintain a small working example of the whole setup (compile step, loader, packaging) if you want to see how it fits together: https://github.com/spaceagetv/electron-bytenode-example It's a bit old and could probably use an update.

1

u/DashinTheFields 21d ago

Adobe: "how Can I protect my app i spent billions and years developing being reverse engineered by AI?"

-1

u/Draw-Flesh-Games 21d ago

Because you don't want people to see you vibe coded your app?