Re: Comments in JSON

2011-07-27 Thread Łukasz Lenart
Hi, I'm working on that issue, but despite the main problem I would like to use JSONWriter to produce the output. I'm going to create Error class that will contains the same structure as is now build by JSONValidationInterceptor. It will wrap the keys and messages with awareness of WW-2721. Kind

Re: Comments in JSON

2011-07-14 Thread Łukasz Lenart
We did an internal research on the issue with JSON and it looks like, the arrays are only vulnerable, if output contains an object, it isn't a valid JavaScript. IE8, FF3, FF5, Chrome Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitur

Re: Comments in JSON

2011-07-13 Thread Dave Newton
On Wed, Jul 13, 2011 at 10:04 AM, Christian Grobmeier wrote: > Exact. Because with comments it cannot be treated as application/json Fair enough; comments aren't in the JSON spec, and: http://blog.getify.com/2010/06/json-comments/ I'm with the blogger. Dave

Re: Comments in JSON

2011-07-13 Thread Christian Grobmeier
2011/7/13 Łukasz Lenart : > 2011/7/13 Dave Newton : >> On Wed, Jul 13, 2011 at 9:08 AM, Christian Grobmeier wrote: >>> For the default value I would just avoid "application" before the >>> slash, because I have experienced that the file is downloaded then. >>> This cannot be easily spotted if you h

Re: Comments in JSON

2011-07-13 Thread Łukasz Lenart
2011/7/13 Dave Newton : > On Wed, Jul 13, 2011 at 9:08 AM, Christian Grobmeier wrote: >> For the default value I would just avoid "application" before the >> slash, because I have experienced that the file is downloaded then. >> This cannot be easily spotted if you have jquery as a frontend. >> Any

Re: Comments in JSON

2011-07-13 Thread Dave Newton
On Wed, Jul 13, 2011 at 9:08 AM, Christian Grobmeier wrote: > For the default value I would just avoid "application" before the > slash, because I have experienced that the file is downloaded then. > This cannot be easily spotted if you have jquery as a frontend. > Anything with "text/" before the

Re: Comments in JSON

2011-07-13 Thread Dave Newton
On Wed, Jul 13, 2011 at 9:08 AM, Christian Grobmeier wrote: > For the default value I would just avoid "application" before the > slash, because I have experienced that the file is downloaded then. > This cannot be easily spotted if you have jquery as a frontend. > Anything with "text/" before the

Re: Comments in JSON

2011-07-13 Thread Christian Grobmeier
>> On 7/13/11 5:06 AM, Christian Grobmeier wrote: >>> >>> In addition to that I would like to see another content type in the >>> response then "application/json" if it is in commented mode, like >>> "text/ext-json". >> >> Since there's no "right" answer to what that alternative mime-type should >>

Re: Comments in JSON

2011-07-13 Thread Łukasz Lenart
2011/7/13 Dale Newfield : > On 7/13/11 5:06 AM, Christian Grobmeier wrote: >> >> In addition to that I would like to see another content type in the >> response then "application/json" if it is in commented mode, like >> "text/ext-json". > > Since there's no "right" answer to what that alternative

Re: Comments in JSON

2011-07-13 Thread Dale Newfield
On 7/13/11 5:06 AM, Christian Grobmeier wrote: In addition to that I would like to see another content type in the response then "application/json" if it is in commented mode, like "text/ext-json". Since there's no "right" answer to what that alternative mime-type should be, I would suggest it

Re: Comments in JSON

2011-07-13 Thread Christian Grobmeier
Rene, with your post you spoke from my heart - +1 & thanks. > So let's say we would provide prominent notice on application startup, level > INFO or even WARN. In case of uncommented JSON activated, say "WARNING: be > sure to have read http://.../General+JSON+Security+Considerations. Maybe you

Re: Comments in JSON

2011-07-13 Thread Rene Gielen
See inline Sent from my iPad On 10.07.2011, at 19:40, Dale Newfield wrote: > On 7/10/11 4:34 AM, Christian Grobmeier wrote: >> Maybe there are other exploits, but only know what you sent as links. >> And those are saying you need a JSON array because JSON objects are >> not valid js statements.

Re: Comments in JSON

2011-07-12 Thread Łukasz Lenart
2011/7/12 Wes Wannemacher : > However, in our JSON plugin, we have a JSON marshaller that is much > more capable. Personally, I think we should take the marshaller (or > potentially the whole plugin) and move it into core, where > JSONValidationInterceptor lives. Then, leverage the marshaller insid

Re: Comments in JSON

2011-07-12 Thread Dave Newton
+1 On Tue, Jul 12, 2011 at 12:09 PM, Wes Wannemacher wrote: > Lukasz, > > One thing that has bugged me for a while is that the source of this > discussion is this class - > > http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidat

Re: Comments in JSON

2011-07-12 Thread Dave Newton
+1 On Tue, Jul 12, 2011 at 12:09 PM, Wes Wannemacher wrote: > Lukasz, > > One thing that has bugged me for a while is that the source of this > discussion is this class - > > http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidat

Re: Comments in JSON

2011-07-12 Thread Wes Wannemacher
Lukasz, One thing that has bugged me for a while is that the source of this discussion is this class - http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java?view=markup Which, you will see when you pull it up

Re: Comments in JSON

2011-07-12 Thread Christian Grobmeier
Hi again, I wrote a short blog post how one can deal in jQuery with the Struts 2 returning /* */ json. http://www.grobmeier.de/json-is-insecure-make-struts-2-and-jquery-vulnerable-safe-12072011.html In addition I made a similar option available to jjson.googlecode.com Struts 2 plugin. I just wan

Re: Comments in JSON

2011-07-12 Thread Christian Grobmeier
> Thanks for all the comments and links, now I've got better overview > what's the real issue here. My idea was the same, to add some flag to > enable / disable comments in the output with default to true. I could not find the place but as this is not standard json the content type of the response

Re: Comments in JSON

2011-07-12 Thread Łukasz Lenart
Thanks for all the comments and links, now I've got better overview what's the real issue here. My idea was the same, to add some flag to enable / disable comments in the output with default to true. I'm going to implement it till weekend, if not, Dale you're welcome to do this as I'm going for sh

Re: Comments in JSON

2011-07-11 Thread Dale Newfield
The patch applied is not backwards compatible, and will break existing sites if they upgrade. Both JSONResult and JSONInterceptor support a wrapWithComments parameter...I think it most sensible to put the same parameter on JSONValidationInterceptor. If we don't do that and default it to true,

Re: Comments in JSON

2011-07-10 Thread Christian Grobmeier
>> Maybe there are other exploits, but only know what you sent as links. >> And those are saying you need a JSON array because JSON objects are >> not valid js statements. > ... > "Yesterday, I blogged about how to steal data from JSON by overriding the > Array constructor. Today, we break into Obj

Re: Comments in JSON

2011-07-10 Thread Dale Newfield
On 7/10/11 4:34 AM, Christian Grobmeier wrote: Maybe there are other exploits, but only know what you sent as links. And those are saying you need a JSON array because JSON objects are not valid js statements. You clearly didn't read all the links I included, or do your own search as I suggest

Re: Comments in JSON

2011-07-10 Thread Christian Grobmeier
>> - don't use javascript arrays to return as a json string > > It really doesn't matter if it's an array or object, if it's valid json that > the browser will attempt to execute it's vulnerable. http://haacked.com/archive/2009/06/25/json-hijacking.aspx "The fact that this is a JSON array is impor

Re: Comments in JSON

2011-07-09 Thread Dale Newfield
On 7/9/11 2:36 PM, Christian Grobmeier wrote: - don't use javascript arrays to return as a json string It really doesn't matter if it's an array or object, if it's valid json that the browser will attempt to execute it's vulnerable. - don't use GET as your method I believe that would prot

Re: Comments in JSON

2011-07-09 Thread Christian Grobmeier
Dale, you gave me a very interesting lecture at this evening, thank you very much for the links. I have learned 2 things: - don't use javascript arrays to return as a json string - don't use GET as your method You mentioned to put everything into a js comment. This breaks the protocol definition

Re: Comments in JSON

2011-07-09 Thread Dale Newfield
Below are a few (of many that I found with a simple google search) explaining the issue in detail. Basically the problem is that

Re: Comments in JSON

2011-07-09 Thread Dale Newfield
If I recall correctly, this was done to help address information leakage. Meaning if you're logged into a web application and also visiting a page on another website, that other page could have a script tag pointing at your web application, resulting in that data being added to the page scope,

Re: Comments in JSON

2011-07-08 Thread Christian Grobmeier
>> Sorry to ask, what is this issue proposing? To accept comments in json >> strings? >> >> I checked specs at http://www.json.org/, but they do not mention >> comments at all. > > To remove comments ;-) ah yes got it Yes they should be removed - I don't know a single json de/en-coder by min

Re: Comments in JSON

2011-07-08 Thread Łukasz Lenart
2011/7/8 Christian Grobmeier : >> Is this still relevant ? >> >> https://issues.apache.org/jira/browse/WW-3545 > > Sorry to ask, what is this issue proposing? To accept comments in json > strings? > > I checked specs at http://www.json.org/, but they do not mention > comments at all. To remove co

Re: Comments in JSON

2011-07-08 Thread Christian Grobmeier
> Is this still relevant ? > > https://issues.apache.org/jira/browse/WW-3545 Sorry to ask, what is this issue proposing? To accept comments in json strings? I checked specs at http://www.json.org/, but they do not mention comments at all. -