Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: JSON::XS and unicode

by Corion (Pope)
on Sep 10, 2012 at 10:59 UTC ( #992721=note: print w/replies, xml ) Need Help??

in reply to Re: JSON::XS and unicode
in thread JSON::XS and unicode

Neither JSON::XS nor the natvie JSON parsers in Javascript execute Javascript code. They all (should) parse the text and reconstruct the data structure using a JSON parser, not the Javascript eval statement, exactly for the reason of not allowing easy Javascript code execution within the page context.

The web application should support that by sending the appropriate content type - which is application/json, at least according to RFC 4627.

Using JSONP sacrifices that security for the convenience of circumventing the same origin policy.

Replies are listed 'Best First'.
Re^3: JSON::XS and unicode
by fluffyvoidwarrior (Monk) on Sep 10, 2012 at 11:24 UTC
    Indeed, yes. No-one in their right mind would actively and intentionally execute passed code. Maybe I'm paranoid, but I won't have executable code coming in from the network under any circumstances. Before I'll accept it, it must be not capable of being executed. Accepting executable code and then trusting that it will never be called... erm... Just seems to me that if you were going to attack a system you would look very closely at JSON and related parsing mechanisms because code is, by definition, already accepted. You're already half way there. In fact you have been supplied with a ready built framework for injecting your malice. After all, if it isn't runnable code it isn't JSON and PHP plus JSON seems like a perfect storm. It's just not likely to be failsafe. At least Perl can be made failsafe.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992721]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2018-05-26 21:17 GMT
Find Nodes?
    Voting Booth?