Search code examples
cross-domainsecurityaccess-controlcross-domain-policy

How do I protect sensitive information from cross site access?


My web application displays some sensitive information to a logged in user. The user visits another site without explicitly logging out of my site first. How do I ensure that the other site can not access the sensitive information without accept from me or the user?

If for example my sensitive data is in JavaScript format, the other site can include it in a script tag and read the side effects. I could continue on building a blacklist, but I do not want to enumerate what is unsafe. I want to know what is safe, but I can not find any documentation of this.

UPDATE: In my example JavaScript from the victim site was executed on the attacker's site, not the other way around, which would have been Cross Site Scripting.

Another example is images, where any other site can read the width and height, but I don't think they can read the content, but they can display it.

A third example is that everything without an X-Frame-Options header can be loaded into an iframe, and from there it is possible to steal the data by tricking the user into doing drag-and-drop or copy-and-paste.


Solution

  • Since I did not get the answer I was looking for here, I asked in another forum an got the answer. It is here: https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.security/9U6HTOh-p4g

    I also found this page which answers my question: http://code.google.com/p/browsersec/wiki/Part2#Life_outside_same-origin_rules