I have a simple web server (in python) with some API endpoints, and an HTML page with a form. When a user submits the form, the form data is sent to the web server via an ajax POST call via jquery. The API endpoint is HTTPs.
For one of the API endpoints, one of the parameters it takes is a password. I suppose the data transfer itself (from browser --> server) is secure as the POST is being done over https (and all the validation is being done on the server). However, I'd like to be able to obfuscate the password such that it will not show up in console logs. (Example - the javascript function which actually makes the api call, is a general function which can post to any endpoint. In a debug mode this function will dump the post json it's about to send. So in the case you're calling the endpoint which takes the password, the password would show up in plaintext in the log.)
I was just curious if there is a best practices way to achieve this? Something not overly complicated? Is it best to encrypt in the browser then decrypt in the server? Or a way to just make the logs show *** ? Note - I'm not concerned about the data being intercepted between browser and server, this is just about preventing anything showing up in the console logs in plaintext.