There are some data need be mask first before transfer to frontend for display, for example phone number 14012345678 will displayed as 1401*****78 on the page. The point here is never transfer original sensitive data to frontend. But how can I update the masked phone number if the operator wants to modify it?
UPDATES:
Let's say we have a system maintain customer information. For data safety, the system operator can only view the masked phone numbers of customer, but the system allow the operator to modify it with a real one. Then on the operator's perspective, The data is shown as following in a modification dialog:
+----------------------------------------------------------+ |Modify Customer | | | | +---------------------------------+ | | Name | David | Required | | +---------------------------------+ | | | | +---------------------------------+ | |Primary phone| 1401*****78 | Required | | +---------------------------------+ | | | | +---------------------------------+ | | Backup phone| 9173*****66 | | | +---------------------------------+ | | | | | | +----------+ +----------+ | | | Cancel | | Save | | | +----------+ +----------+ | | | +----------------------------------------------------------+
Assume the operator change the Backup phone to real one and click Save, then how the backend deal with the Primary phone? Posting it with empty value is obviously inappropriate since it is required and the backend will check it(plus the phone formatting check).
I'm not seeing what your actual problem here is, but the solution to the problem that you stated is to simply provide a text input field in the web page for the user to enter the new value. You can use
<input type="password">
if the information is so sensitive that the user may be concerned about (say) someone reading the new value over their shoulder as they type it.The point of the masking is to avoid revealing information to someone who is not the real user. But if they are providing the information themselves, masking is not necessary. They already know the information.
Concerning the update, it seems that you want to allow the operator to be able to submit the form with (say)
1401*****78
in the primary field form. Well you can do that! On the server side you would need check what has been sent asprimary_phone
, to see if it contains masking characters. If so, you would (presumably) treat that as meaning "don't change that number"). Likewise for thebackup_phone
field.But this strikes me as a bizarre (i.e. not properly thought out) requirement. It doesn't make sense to me for the operator to be able to change the phone numbers without knowing what they were before. I would check with the customer to make sure that 1) you really understand what these requirements are saying, and that 2) it is what the customer actually needs.
The other things to note are:
Sending sensitive information over an insecure HTTP session is potentially worse than not masking the phone number.
1 - ... unless you are asking for the information in order to authenticate them. But authenticating someone by asking them to enter a phone number is terribly weak. Knowledge of a phone number doesn't prove it is yours!