0

I am developing an application containing both Python backend and frontend using Electron. There is no authentication. The two components communicate through WebSocket. How should I prevent the third party from connecting to the port?

1

You need to be able to distinguish between the trusted client and the untrusted third party in order to block the third party. This means that you somehow need to find out when the trusted client connected and when the connection does not come from the trusted client. This means you need some form of authentication but it does not need to be some setup with users and passwords or similar. How this authentication is done depends on your specific setup, i.e. it might simply be a specific IP associated with the correct client, it might be a token only the trusted client knows, it might be authentication based on a certificate (i.e. mutual authentication in wss://) etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.