Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] bones.token in cache gets overwritten if multiple request are made in IE #73

Open
dugokontov opened this issue Feb 13, 2013 · 0 comments

Comments

@dugokontov
Copy link

This bug only occurs in IE. I have tested it in IE8 and IE9.

Minimum code to reporoduce this error is to use Bones sample application, enable PUT request in Project.server.bones.js file (by commenting line 14) and executing this code:

var modelObj = new Bones.DEBUG.models.Project({id: "underscore"});
for (var i = 0; i < 2; i++) {
    modelObj.save(modelObj.attributes, {
        success: function(arg) {
            console.log(arg);
        },
        error: function(arg) {
            console.log("it failed");
        }
    });
};

This will create two calls to server. In IE only last one will be processed, while other(s) will receive 403 error code. Inspecting request shows that bones.token key is not same in cookies and body.

In further research I found out that when more that two request are made, cookie's key would remain same for 2-4 requests, and then it would be changed. From this I concluded that issue is how CSRF is stored (bones/client/backbone.js:14).

There cookie is written in document.cookies, returned and stored in modelJSON object and after that $.ajax call has been made. My guess is that $.ajax makes ajax calls somewhat differently in IE than in other browser, because document.cokies gets overwritten by next save call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant