same-origin-policy

Why do frame breakers work cross-domain, and can you conditionally use frame breakers?

倖福魔咒の 提交于 2019-11-29 06:29:32
I've been investigating frame breaking code recently and have come across some really bizarre behavior related to the same origins policy that I am having trouble understanding. Suppose I've got a page Breaker.html on domain A, and a page Container.html on domain B. The example frame breaker code would go into Breaker.html, like below: if (top !== self) top.location.href = self.location.href; This will successfully break Breaker.html out of Container.html, but I don't understand why it should. From my reading of the same origins policy, top.location shouldn't be accessible at all , since

Origin evil.com in Request Header

梦想的初衷 提交于 2019-11-29 04:20:16
问题 I am trying to send form data to a webservice but below "Request Header" in the "Network" of the Chrome DOM I got the origin "evil.com" and referer "localhost:8080". Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-Language:nb-NO,nb;q=0.8,no;q=0.6,nn;q=0.4,en-US;q=0.2,en;q=0.2 Connection:keep-alive Content-Length:91 Content-Type:application/x-www-form-urlencoded; charset=UTF-8; Host:office.insoft.net:9091 Origin:http://evil.com/ Referer:http://localhost:8080/ User

What is the issue CORS is trying to solve?

南笙酒味 提交于 2019-11-29 02:59:05
I've been reading up on CORS and how it works, but I'm finding a lot of things confusing. For example, there are lots of details about things like User Joe is using browser BrowserX to get data from site.com , which in turn sends a request to spot.com . To allow this, spot has special headers... yada yada yada Without much background, I don't understand why websites wouldn't let requests from some places. I mean, they exist to serve responses to requests, don't they? Why would certain people's of requests not be allowed? It would really appreciate a nice explanation (or a link to one) of the

Same-Origin Policy and serving JS from a CDN

六眼飞鱼酱① 提交于 2019-11-29 02:49:00
问题 I want to serve my JavaScript scripts from a CDN like cloudflare. Now my scripts communicate with my app server via ajax. Wouldn't the same-origin policy restrictions come into play when I load these scripts from a CDN? Let's say my app is on the domain: http://app.com And I load my scripts from http://cdn.com/xyz/all.js Now, since my scripts are loaded from a different domain than the domain my app is running from, I guess the same origin policy would prevent me from doing ajax communication

Why is $.post() subject to same-origin policy, but submitting a form with method='POST' okay?

不羁岁月 提交于 2019-11-28 21:24:21
I'm working on a web-based tool which streamlines the work we do at my office. The tools provided to us by our partner have a generic login that our entire floor uses, but it times out every 30 minutes, which is annoying to have to log-into again all day. What I had done in the past, was create a hidden iframe inside my tool which logs into it by submitting a hidden form on page load, and continuing to submit the form every 30 minutes to prevent a timeout. They can then submit searches to the partner tool directly from my tool (via another, visible form). I'd like to use jQuery $.post() to

The `--disable-web-security` command is seems no longer working

人走茶凉 提交于 2019-11-28 21:14:15
The command --disable-web-security to allow for cross domain requests on Chrome is no longer working, I presume due to the latest update. Is there a workaround for this, besides downloading an older version of chrome and disabling updates? Might as well ask in the same question, the javascript snippet suggested to turn off web security in Firefox never works for me: try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) { alert("UniversalBrowserRead failed"); } The page always alerts UniversalBrowserRead failed . Kill all instances and try again. Had the

How to make BrowserSync work with an nginx proxy server?

此生再无相见时 提交于 2019-11-28 18:55:24
(If needed, please see my last question for some more background info.) I'm developing an app that uses a decoupled front- and backend: The backend is a Rails app (served on localhost:3000 ) that primarily provides a REST API. The frontend is an AngularJS app, which I'm building with Gulp and serving locally (using BrowserSync ) on localhost:3001 . To get the two ends to talk to each other, while honoring the same-origin policy , I configured nginx to act as a proxy between the two, available on localhost:3002 . Here's my nginx.conf: worker_processes 1; events { worker_connections 1024; } http

window.name as a data transport: a valid approach?

吃可爱长大的小学妹 提交于 2019-11-28 16:49:38
Overview and original question window.name is an interesting beast. MDN's description hints at the original intent: The name of the window is used primarily for setting targets for hyperlinks and forms. Windows do not need to have names. So, this means we can open the console in this window, and write: var win = window.open('http://google.com', 'el goog'); ...and then let it through the popup blocker, that should open google.com in a window named "el goog." I can't access the name property of win because of the same-origin policy, but if I open a console in the new window and type name , I'll

WebView Javascript cross domain from a local HTML file

…衆ロ難τιáo~ 提交于 2019-11-28 16:13:52
I load a local html file (from assets folder) to the app WebView. In the HTML I run a jQuery.getJSON(url). the url is a remote server. This action fails, and I'm guessing because of a different origin issue (cross domain). I run the same file on chrome and there it specifically says so. Is there a way to allow the WebView in Android to load data from remote server on a local loaded HTML file? Today morning I found solution that seems to be working. The Java part Initialize your WebView: WebView _webView = (WebView) this.findViewById(R.id.id_of_your_webview_in_layout); get WebView settings:

Why Same-origin policy isn't enough to prevent CSRF attacks?

谁说胖子不能爱 提交于 2019-11-28 16:13:35
First of all, I assume a backend that control inputs to prevent XSS vulnerabilities. In this answer @Les Hazlewood explain how to protect the JWT in the client side. Assuming 100% TLS for all communication - both during and at all times after login - authenticating with username/password via basic authentication and receiving a JWT in exchange is a valid use case. This is almost exactly how one of OAuth 2's flows ('password grant') works. [...] You just set the Authorization header: Authorization: Bearer <JWT value here> But, that being said, if your REST client is 'untrusted' (e.g. JavaScript