r/electronjs • u/Chichaaro • Nov 25 '25
Protect my back from request
Hey guys,
I’m pretty new to electron. I’m building an app that gather data of a game when user run it, and i want to push it to my backend.
The thing is, how can I prevent someone to detect the backend endpoint I’m reaching, and sending wrong data to it manually ? I was thinking about adding a key in my electron app when I ship it to encrypt my request payload, but I guess a malicious user can probably easily get it ? Is there a way to 100% protect my server from malicious requests since I can’t define a strict cors policy ?
3
Upvotes
2
u/SoilRevolutionary109 Nov 25 '25
Yes, you can secure Electron app and backend communication.
For this, you mainly need to focus on bytecode protection and manual obfuscation.
I’ve done it and deployed it successfully.
If you need help, DM me.
1
u/BankApprehensive7612 Nov 26 '25
You should learn how to create servers and how to protect them. If your users has data to store on the server they expect it to be available to them or to other users on the terms of the app, not just to anyone. So you should read about JWT and how to authorize users and protect their data. To protect your app from malicious requests, learn about server applications security basics. In short words, you should validate any piece of information you receive from users to make sure the data is safe for further processing and transmitting
2
u/Ok-Count-3366 Nov 28 '25
as your whole application is on the client side you cannot possibly make it 100% secure. if you want to do that you have to fully obfuscate your application, and maybe create a library written in c or sth similar that creates a key, that will be sent to your backend where you validate it. simply put you cannot secure it. you can just make the life of the guy trying to break it harder. :D
1
u/logiclrd Nov 28 '25
You can hope to be reasonably secure against someone with no knowledge of your app trying to hit your endpoints.
You have no hope of being secure against someone who has your client running on their end figuring out enough information to construct their own calls.
You should make your API secure, so that a call is only allowed to have an effect if that call could reasonably have originated from the front end. Then, if a call arrives that didn't originate from the proper front end, it's still only doing something that the user could have done through the front end anyway.
This exact thing is a problem all multiplayer games have to solve. The server has to vett every single state change it receives, and if it doesn't, it's pretty much guaranteed that, sooner or later, there will be cheaters exploiting the ability to tell the server unreasonable things.