Tag Archives: array
Little tricks: concatenating arrays in Javascript
It happens that when working with Javascript frameworks like MooTools for a long time, it’s easy to forget how to do things in plain/native Javascript. For example, concatenating arrays is an easy task thanks to the Function object method apply: var array1 = [1,2,3,4]; var array2 = [5,6,7]; array1.push.apply(array1, array2); // array1 = [1, 2, [...]
Interesting JSON vulnerability (old stuff)
Somebody at work passed this article about an interesting vulnerability in web APIs that use JSON. The exploit combines Cross Site Request Forgery (CSRF) with a JSON Array hack allowing an evil site to grab sensitive user data from an unsuspecting user. The hack involves redefining the Array constructor, which is totally legal in Javascript. http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx [...]
