Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 38814 invoked from network); 17 Sep 2010 07:28:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Sep 2010 07:28:16 -0000 Received: (qmail 14577 invoked by uid 500); 17 Sep 2010 07:28:16 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 14486 invoked by uid 500); 17 Sep 2010 07:28:14 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 14479 invoked by uid 99); 17 Sep 2010 07:28:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 07:28:14 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [148.87.113.121] (HELO rcsinet10.oracle.com) (148.87.113.121) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 07:28:05 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o8H7Rg7D020773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Sep 2010 07:27:43 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o8GI9AIZ020536 for ; Fri, 17 Sep 2010 07:27:41 GMT Received: from abhmt008.oracle.com by acsmt353.oracle.com with ESMTP id 605941461284708406; Fri, 17 Sep 2010 00:26:46 -0700 Received: from [129.159.139.223] (/129.159.139.223) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 17 Sep 2010 00:26:45 -0700 Message-ID: <4C931841.3020006@oracle.com> Date: Fri, 17 Sep 2010 09:26:57 +0200 From: Kristian Waagan User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.7) Gecko/20100817 Thunderbird/3.1.1 MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: Purpose of OSReadOnlyTest (DERBY-3837) References: <4C91FA76.1010100@oracle.com> <4C922DC4.7090306@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 16.09.10 19:02, Myrna van Lunteren wrote: > On Thu, Sep 16, 2010 at 8:33 AM, Knut Anders Hatlen > wrote: >> Bryan Pendleton writes: >> >>>> Since the comment in DERBY-3837 says the purpose of the test is to test >>>> operation on read-only media, do you agree that we should make the >>>> database directory truly read-only? >>> +1. >>> >>> Thanks for tracking this down, and for the detailed description. Very >>> interesting! >> I agree. Having a database that's partly read-only and partly writable >> doesn't sound like a use case we would want to support, so +1 to making >> the database in the test truly read-only. >> >>>> And while I'm at it, I might want to move some of the file-system >>>> helper methods into PrivilegedFileOpsForTests. The motivating factor >>>> is that when a removal of a directory fails (recursive delete), it may >>>> be useful to see which files couldn't be deleted. The question is if >>>> it is okay to add a public static persistent recursive delete method >>>> running in a privileged block to the test code? >> You're asking because it's considered bad security practise to have >> public helper methods doing privileged operations, right? If I >> understand correctly, it will only be a security risk if someone runs >> their production server with derbyTesting.jar in the classpath and has >> granted delete permissions to derbyTesting.jar. I don't think that's >> something we need to be concerned with in the test code. >> >> -- >> Knut Anders >> > I agree also to making the db fully read-only. Thanks for the analysis! > > I thought it would be obvious that derbyTesting.jar has no place in a > production system...If you make this change to the helper method, do > we need to document somewhere that the derbyTesting.jar opens up > security issues or would it be obvious enough? Hi Myrna, I think it's obvious enough - don't make testing/debug code accessible in a production environment. We already have file methods in there that are public static, but none of them delete files. If you fire off what I call "persistent recursive delete", it will try to delete all files in the specified path and it will not stop until it has tried to delete every single file and directory in the specified path. Of course, it's no more dangerous than writing 'rm -Rf ', except that the visibility is poorer. So, during testing, you do not want to point the method at your home directory and run without a security manager... I'll see if I can add some kind of safeguard to isolate the method to the base test directory - the test framework should limit its file activities to that directory in any case. This will reduce the chances of causing havoc for an unfortunate Derby developer running with a misconfigured or no security manager. I logged DERBY-4804 to track the work. @Knut Yes, that's the reason why I ask - and I do feel I'm being rather cautious in this case :) Thanks, -- Kristian > Myrna