I have done quite a lot of reading in the past week over how to build a secure auth architecture. Based on my reading:
I am running a React app (SPA, non server rendered) with authentication using JWT generated on a node.js server. I place the JWT in an httpOnly cookie, secure over https, sameSite, short-ish life span for both JWT and the cookie and I have cors configured on my server to only allow my frontend domain. I also generate a csrf token server side upon loading my React app - client calls an endpoint, csrf token is sent back in the json and I set a X-CSRF-Token header with it. Since cors only allows my domain requests, and I understand that CSRF attacks originate from another domain, I understand that I can protect my CSRF token endpoint.
On a scale from 0 to 5, 0 being absolutely unsafe and 5 very safe, how safe is my architecture above to protect from a CSRF attack? If less than 5, what would you recommend I do more? Thanks,