The angular website recommends prefixing your JSON with c )]}'\n to protect them from a name that is invoked as JSONP:
The JSON vulnerability allows third-party sites to turn your JSON resource URL into a JSONP request under certain conditions. To counter this, your server can prefix all JSON requests with the following line ")]} ', \ n". angular will automatically split the prefix before treating it as JSON.
But the referenced article has no mention of these closing brackets, and it seems that it would be pretty easy to work (since my JSONView chrome plugin has been fixed to cut them out. Why not do this for an “attacker”?).
Instead, the article recommends wrapping JSON as an object:
{"d": ["Philha", "my-confession-to-crimes", 7423.42]}
Something is protecting you.
Why does AngularJS prefer this (odd) protection and does it work? I am not sure how to check this.
source share