Question on script security

Hello,

We’re developing a web app and we’re wondering if there’s a way to prevent the user from inspecting the page or seeing the javascript. Most browsers have a console that you can open up and see the DOM elements and any scripts running on the page. Most of them even allow you to hover over variables and see the data, some of which might include database IDs and other private information. While we try to make as little sensitive/private information available as possible, the fact that users can inspect the page and view information behind the scenes is a bit of a security hole.

What we want to know is: can the viewing of DOM elements or scripts be disabled from the web app side?

Or: can we at least minimize the javascript when we deploy?

For this last part, we are using Visual Studio 2015, and Gulp packages to package everything together (javascript, CSS, etc.) during deployment. All I would need to know is how to setup a gulp package to minimize the Javascript (which is packaged into one file during deployment called app.js).

Does anyone have any tips on how to make sensitive information a bit more secure in the browser console? Thanks.

General rule of security is: what is published on the Internet is not secure. There’s no way for you to prevent DOM analysis or JS analysis, since they are downloaded to the user. And you have no control what tools will users use, what browsers etc.

Sure you can: https://middlemanapp.com/advanced/file-size-optimization/ But still it doesn’t make it impossible to debug/analyse.