harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruth Cao (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2910) [classlib][security] Harmony cannot identify 'codeBase' feature in policy file
Date Sat, 30 Dec 2006 02:32:23 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-2910?page=comments#action_12461469 ] 
            
Ruth Cao commented on HARMONY-2910:
-----------------------------------

Hi,

I've written a simple test as followed:

public class FileTest  {	
        public static void main(String[] args) throws Exception {		
              String name1 = new File(new URL("file:///c:/api/*").getFile()).getAbsolutePath();
              System.out.println("name1: " + name1);
              String name2 = new File(new URL("file:///c:/api/*").getFile()).getCanonicalPath();
              System.out.println("name2: " + name2);
	}
}

Harmony prints:
name1: c:\api\*
name2: C:\api\*

It seems there is no bug in j.i.File for this issue since it only converts the driver letter
from lower case 'c' to upper case 'C', which complies with the spec.

So perhaps the only problem  is in DefaultPolicyParser as my patch indicates. Would some security
expert have a look and give some suggestion? Thanks a lot. :-)



> [classlib][security] Harmony cannot identify 'codeBase' feature in policy file
> ------------------------------------------------------------------------------
>
>                 Key: HARMONY-2910
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2910
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ruth Cao
>         Assigned To: Stepan Mishura
>         Attachments: Harmony-2910.diff
>
>
> create a simple policy file and then run PolicyTest  with the argument and the policy
file[1] as following on Windows XP:
> -Dtest.bin.dir=c:\api\ -Djava.security.policy=<policy file path>
> public class PolicyTest {	
> 	public static void main(String[] args) throws Exception {
> 		Policy p = Policy.getPolicy();
> 		ProtectionDomain pd = new ProtectionDomain(new CodeSource(new URL(
> 				"file:/c:/api/*"), (java.security.cert.Certificate[]) null), null);
> 		PermissionCollection pCollection = p.getPermissions(pd);
> 		Enumeration<Permission> elements = pCollection.elements();
> 		while (elements.hasMoreElements()) {
> 			if(elements.nextElement().equals(new AllPermission())){
> 				System.out.println("contains AllPermission");
> 			}
> 		}
> 	}
> }
> RI prints:
> contains AllPermission
> while Harmony prints nothing.
> [1]
> grant codeBase "file:${test.bin.dir}/-" {
>    permission java.security.AllPermission; 
> }; 

-- 
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