Preventing some source code from being viewed

Posted on 2014-07-21
Last Modified: 2014-07-25
Hello experts.

I'm hoping you may be able to help me with an issue with Firefox.

We use an online reporting system called Dapresy and we use it to provide our clients with access to their customer data (we run satisfaction surveys).

We want to benchmark these clients against each other using this online system and we want it to be completely anonymous.

We've managed to make a chart that has all the scores on screen and you cannot see which score applies to which client. If you view the source code, it seems to show the source for only a certain part of the page - which is great!

However in firefox, if you press CTRL+A then click "View Selection Source" it shows the source code for the charts and then unfortunately shows the order in which the clients are.

We have the power to edit CSS and we can also put in some Custom HTML into the projects we have in the system.

I know it's probably useless having this without experts knowing anything about Dapresy (the online system), but I didn't know if there was any generic javascript, or CSS or other people who may have come across a way to prevent the "View Selection Source" option.
Question by:INHOUSERES
  • 2
  • 2
  • 2
  • +2
LVL 40

Accepted Solution

Kyle Abrahams earned 500 total points
ID: 40209177
What if you obfuscate them before you present them in the chart?

EG:  Have another field called CustomerReportingName in the database.
Populate it with random (unique) data for each client.

Use that instead, now the data means nothing unless you have access to the database.
LVL 58

Expert Comment

ID: 40209180
If it's in the browser there is nothing you can do to prevent people seeing the source
There are js routines that can disable right click on the page but it takes all of 2 seconds to get around it

Expert Comment

by:c l
ID: 40209188
the general answer is "no", there wil always be a way to, once a page request has been made, to view that code. There are javascript techniques that you can use to discourage people from viewing source, but those people tech savy enough will generally find a way around those "discouraging" techniques. once the page has been served to the end user, anyone can just locate that page in their temp directory and view it from there.
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.


Author Comment

ID: 40209211
Thanks for the swift responses.

Kyle - It's kind of a WYSIWYG program so we don't have raw access to the databases. We upload data in .sav and one of the options I was thinking of would be to give clients a 5 letter/digit code to represent their company. This would probably change each month to keep it fresh.
This would be a last resort though.

Gary/CL - I thought this would be the case, but if you view the source without selecting then you don't see it. It works perfectly in IE and Chrome because you don't have the function to View Selection Source.
I also added this to the CSS to try and prevent highlighting. This only works properly in Chrome though:

-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;

You cant click and drag to highlight in Firefox or Chrome, but you can in IE.
If I could prevent highlighting in Firefox, it may be enough prevention to ensure it's anonymity. Although it's not impossible, it's incredibly improbable that a client of ours would go to such lengths to find out who it who... However the more I can prevent, the better.
LVL 58

Expert Comment

ID: 40209241
It must be loading in a frame or through ajax? Cannot tell from their site since they don't show an example That would explain why it's not directly visible in the browsers view source
The css you have covers all browsers so it should work in IE

Other option is to overlay a transparent div covering the page so you cannot actually select anything.
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 40209242
Same approach . . . if the data is in .SAV then update .sav and replace the customer's name with something else.  You're generating the .SAV from somewhere.  

I would NOT recommend trying to just hide the data.  Any JS function can be disabled, and with firebug you can pretty much do anything you want.  The only way to truly secure this is to change / obfuscate the data before it's presented to the user.
LVL 53

Expert Comment

ID: 40209800
If you find a way to do this please notify me and we will patented the method and becomes billionaires.  Seriously, a browser; ANY BROWSER is designed to do exactly what you are trying to prevent.  You can spend all the time and effort you want, but it will be a waste, because if you find something that succeeds you will also have a method that prevents the browser from rendering the page.

On each of my browsers I have a button from an addon.  When I click on the button it list my cache and I can do anything I want with the content from a site.  A common addon?  if you do a search for cache viewer Google will return about 10 million hits listing versions for every browser in the universe.  Given the amount of effort to create that many variations, I would say the demand is high enough that they are commonly in use.  However if you find a way we can get rich in a hurry.


Author Comment

ID: 40218750
Probably have to to shelf this then...

The only way is to try and manipulate the data before it's HTMLised.

Looks like "Obfuscate" will be a new word in my vocab.

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question