I'm tossing around the idea of, sometime way in the future, building a React SPA for our Miva site, letting Miva handle the backend as a sort of headless ecommerce CMS. It may never happen, but the idea is on my mind, maybe just because I think it would be fun.
Meanwhile I need to make some updates to the customer account edit screen on our current site, so as a trial I'd like to write a drop-in React component that will handle the guts of the page (change password, change billing / shipping address, etc).
I'm not at all a security expert, so I'm wondering about whether this is possible to do securely. The system would need to be able to pull the customer's current account data and display it back to them in an editable form, and then send updates back as posts
The main problem I'm thinking about is, how will the system securely use our JSON API token / signature? I can probably set up a PHP script that pulls them from a table in the DB somewhere, and let the system grab them via a secure post/response, so at least they won't be hardcoded into the javascript bundle. But really what's the point of that - the PHP script would need to always respond with the token / signature, so anyone/anything nosy enough to find out the URL of the PHP script would be able to send a similar post and get the token / signature.
The more I think about it as I write this post, the more I think it won't work. For example even if I could somehow securely send a post to the JSON API to edit the customer's account, the app (or rather, the user's browser) would be able to edit *all* accounts that it knew, or guessed, the customer login for (the customer update portion of the API can use the login as the key).
Anyone have any thoughts / ideas? Maybe I'm over-thinking it or maybe I missed a much better alternative?
Meanwhile I need to make some updates to the customer account edit screen on our current site, so as a trial I'd like to write a drop-in React component that will handle the guts of the page (change password, change billing / shipping address, etc).
I'm not at all a security expert, so I'm wondering about whether this is possible to do securely. The system would need to be able to pull the customer's current account data and display it back to them in an editable form, and then send updates back as posts
The main problem I'm thinking about is, how will the system securely use our JSON API token / signature? I can probably set up a PHP script that pulls them from a table in the DB somewhere, and let the system grab them via a secure post/response, so at least they won't be hardcoded into the javascript bundle. But really what's the point of that - the PHP script would need to always respond with the token / signature, so anyone/anything nosy enough to find out the URL of the PHP script would be able to send a similar post and get the token / signature.
The more I think about it as I write this post, the more I think it won't work. For example even if I could somehow securely send a post to the JSON API to edit the customer's account, the app (or rather, the user's browser) would be able to edit *all* accounts that it knew, or guessed, the customer login for (the customer update portion of the API can use the login as the key).
Anyone have any thoughts / ideas? Maybe I'm over-thinking it or maybe I missed a much better alternative?
Comment