lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-56) PATCH: JSONResponseWriter JSON result wrapper function
Date Wed, 18 Oct 2006 20:00:37 GMT
    [ http://issues.apache.org/jira/browse/SOLR-56?page=comments#action_12443348 ] 
            
Yonik Seeley commented on SOLR-56:
----------------------------------

Thanks Bertrand, interesting stuff!

Since yahoo calls the parameter "callback", should we call ours "json.callback", or do people
think that name is too long?  On the other hand, wrapper function *is* more descriptive about
what it does to the actual response.  I'm undecided...



> PATCH: JSONResponseWriter JSON result wrapper function
> ------------------------------------------------------
>
>                 Key: SOLR-56
>                 URL: http://issues.apache.org/jira/browse/SOLR-56
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>         Environment: Tested on macosx 10.4.8, JDK 1.5
>            Reporter: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: JSONResponseWriter.wrf.patch
>
>
> This patch adds a "json.wrf" parameter to add a wrapper function around the JSON results,
for example:
>   json.wrf = eatJason
>   search result = eatJason({"header":{"qtime":0},...}))
> The result set is sent as a parameter to eatJason instead of being sent as a plain data
structure.
> This is useful to work around the cross-site limitations of JSON, when a client uses
code like
>   var head = document.getElementsByTagName("head")[0];
>   script = document.createElement('script');
>   script.id = 'uploadScript';
>   script.type = 'text/javascript';
>   script.src = "http://mysolrserver/solr/select?q=role:video&wt=json&json.wrf=eatJason";
>   head.appendChild(script)
>   function eatJason(obj){
>      ...process obj which is Solr's JSON result
>   } 				
> However, I'm no javascript expert, and passing an arbitrary javascript function name
in the request parameters feels a bit weird...wondering if this might enable some cross-site
scripting scenarios?
> But the technique is well-known apparently, see:
>   http://www.theurer.cc/blog/2005/12/15/web-services-json-dump-your-proxy/
> and 
>   http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message