I have a Node server with a single POST endpoint. I am using it along side a React app but I do not want anyone else to be able to access it.
I set this server to handle data that I do not want or can manipulate in the client. One cannot retrieve any data from the server, but they can manipulate what they send in a particular way that I would want protected.
Is there any other way to prevent anyone from retrieving info from the POST endpoint without setting up user authentication?
I noticed that I can hit it with a cURL command if I have the correct url and the correct JSON data values.
I have set up CORS to only allow hits from my domain as follows:
app.use(
cors({
origin: [
'http://myWebsite.com',
'http://www.myWebsite.com',
'https://myWebsite.com',
'https://www.myWebsite.com',
],
}),
);
EDIT WITH SOLUTION: For anyone that stumbles upon this, I added https://cryptojs.gitbook.io/docs/ to my frontend and my node server and added env variables on both as a secret. Without the crypto key, the service is not usable. That solved my problem.