简体   繁体   中英

How can I hide sensitive information in a web page?

I am trying to send a json object that holds quiz data [including answers] from my code behind to javascript. I used...

var quizJson = <%=jsonObj%> 

but the issue is, my users are smart enough to use view source and reveal the answers. Any suggestion?

Thanks in advance

The only correct solution is not to send the answers to the browser in any form. The browser needs to send the answers that the user enters back to the server. Then you use the server-side code to determine if the answers are correct.

Do an AJAX call when the user chooses an answer. This way, validation will be external and the users won't be able to view the source to find the answer.

Anything you send to the clent for use in client side scripts can be read by any client. Even if you somehow obscure the answer in the source, anyone can pull up a debugger and see the real answers when you "decode" them. This is just like a lot of classic game hacks, where people would disable walls and see what is past them. Anything you send to the client is vulnerable !

The only way to protect the answers is to keep them on the server. Post the attempted answers to the server, then grade them there and return the results to the client.

Use a simple encryption (like this ) in order to hide the text from the user. If the data is not important, then that will drive off the average inspection.

However, if the answers are important to keep hidden, then keep them hidden...and off client side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM