Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by HossMan: http://wiki.apache.org/solr/SolrSecurity The comment on the change is: XSRF warning ------------------------------------------------------------------------------ + = Solr Security = + First and foremost, Solr does not concern itself with security either at the document level or the communication level. It is strongly recommended that the application server containing Solr be firewalled such the only clients with access to Solr are your own. A default/example installation of Solr allows any client with access to it to add, update, and delete documents (and of course search/read too), including access to the Solr configuration and schema files and the administrative user interface. Besides limiting port access to the Solr server, standard Java web security can be added by tuning the container and the Solr web application configuration itself via web.xml. For example, all /update URLs could require HTTP authentication. + [[TableOfContents()]] - = Security-related questions: = + == Cross-Site Scripting (XSS) == - '''Q:''' Does Solr contain any known cross-site scripting vulnerabilities? - '''A:''' No. + Solr has no known [http://en.wikipedia.org/wiki/Cross-site_scripting cross-site scripting vulnerabilities]. + + == Cross-Site Request Forgery (CSRF) == + + Even if a Solr instance is protected by good firewalls so that "bad guys" have no direct access, that instance may be at risk to potential "[http://en.wikipedia.org/wiki/Cross-site_request_forgery Cross-Site Request Forgery]" based attacks if the following are all true: + 1. Some number of "good guys" have direct access to that Solr instance from their web browsers. + 1. A "bad guy" knows/guesses the host:port/path of the Solr instance (even though they can not access it directly) + 1. The bad guy can trick one of the good guy into clicking a maliciously crafted URL, or loading a webpage that contains malicious javascript. + + This is because Solr's most basic behavior is to receive updates and deletes via HTTP. If you have a firewall or other security measure restricting Solr's /update handler so it only accepts connections from approved hosts/clients, but ''you'' are approved then you could inadvertently be tricked into loading a web page that initiates an HTTP Connection to Solr on your behalf. + + It's important to keep this in mind when thinking about what it means to "secure" an instance of Solr (if you have not already). + + A basic technique that can be used to mitigate the risk of a possible CSRF attack like this is to configure your Servlet Container so that access to paths which can modify the index (ie: /update, /update/csv, etc...) are restricted either to specific client IPs, or using HTTP Authentication. - ------ - - - === Path Based Authentication === + == Path Based Authentication == /!\ TODO - include web.xml example... @@ -34, +46 @@ Any queries into /instock, such as /instock?q=ipod, will always be limited to documents with an indexed inStock field containing a value of "true", and all responses will include facet counts for the "cat" field. - === Document Level Security === + == Document Level Security == + Although Solr does not directly support Document level security, the SolrRequestHandler framework is easy to configure for your specific needs. If you need permission based authentication -- where user A can update document 1 and 2, but not 3 -- you will need to augment the request with user information. Either you can add parameters to the query string (?u=XXX&p=YYY) or use a custom dispatcher filter that augments the context: @@ -76, +89 @@ }}} + == Streaming Consideration == - === Streaming Consideration === If streaming is enabled, you need to make sure Solr is as secure as it needs to be. When streaming is enabled, the parameters "stream.url" will go to a remote site and download the content. Likewise, "stream.file" will read a file on disk. Streaming is disabled by default and is configured from solrconfig.xml
