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

Sometimes, csrf magic interferes with my json request. #12

Open
rhedin opened this issue Jan 24, 2017 · 2 comments
Open

Sometimes, csrf magic interferes with my json request. #12

rhedin opened this issue Jan 24, 2017 · 2 comments

Comments

@rhedin
Copy link

rhedin commented Jan 24, 2017

About half the time I find "junk" in my request payload. Naturally, the site I am communicating with complains. {"message": "Unsupported JSON format : Could not create a JSON event when trying to serialize"}

__csrf_magic=sid:1abf8...,1485208109&{"sessionId": "johnsSession", ... "productId": "berli18"}

The other half of the time, the payload is not affected. I get a 200 back.

{"sessionId": "johnsSession", ... "productId": "berli18"}

Is there some technique to leave particular requests out of the special magic? I think you add something to XMLHttpRequest's prototype. Perhaps I should new the original object. Is that available somewhere?

@ezyang
Copy link
Owner

ezyang commented Feb 4, 2017

The original function is always saved as csrf_functionname; look in csrf-magic.js to see how its done. Maybe we should just split the JS file into two and make the overloading optional...

@netniV
Copy link

netniV commented Feb 23, 2020

I believe this was resolved by modifying the send and process functions to properly identify when objects were being used and thus inject the magic token as an element of the object rather than as a prefix string (which is incorrect).

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

3 participants