Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes [v2]

2021-01-11 Thread Sean Mullan
On Fri, 8 Jan 2021 21:30:14 GMT, Martin Balao  wrote:

>> As described in JDK-8259319 [1], this fix proposal is to set proper access 
>> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
>> when a Security Manager is installed and the fallback scheme is used.
>> 
>> No regressions found in jdk/sun/security/pkcs11 tests category.
>> 
>> --
>> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319
>
> Martin Balao has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Limit P11Util::getProvider privileged access to the required 
> 'accessClassInPackage' RuntimePermission only.
>  - New line character inserted at the end of IllegalPackageAccess.java test 
> file

Marked as reviewed by mullan (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes [v2]

2021-01-11 Thread Valerie Peng
On Fri, 8 Jan 2021 21:30:14 GMT, Martin Balao  wrote:

>> As described in JDK-8259319 [1], this fix proposal is to set proper access 
>> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
>> when a Security Manager is installed and the fallback scheme is used.
>> 
>> No regressions found in jdk/sun/security/pkcs11 tests category.
>> 
>> --
>> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319
>
> Martin Balao has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Limit P11Util::getProvider privileged access to the required 
> 'accessClassInPackage' RuntimePermission only.
>  - New line character inserted at the end of IllegalPackageAccess.java test 
> file

Changes look good.

-

Marked as reviewed by valeriep (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes [v2]

2021-01-08 Thread Martin Balao
On Fri, 8 Jan 2021 19:35:47 GMT, Valerie Peng  wrote:

>> Martin Balao has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Limit P11Util::getProvider privileged access to the required 
>> 'accessClassInPackage' RuntimePermission only.
>>  - New line character inserted at the end of IllegalPackageAccess.java test 
>> file
>
> test/jdk/sun/security/pkcs11/KeyAgreement/IllegalPackageAccess.java line 96:
> 
>> 94: }
>> 95: 
>> 96: }
> 
> nit: add a newline here, to get rid of the red icon...

Yes, sure. Thanks for your feedback.

> src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java line 
> 102:
> 
>> 100: }
>> 101: }
>> 102: });
> 
> Sean's suggestion is to add additional arguments here, e.g. null, new 
> RuntimePermission("accessClassInPackage." + ).

Yes, replied to Sean above. Thanks.

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes [v2]

2021-01-08 Thread Martin Balao
On Thu, 7 Jan 2021 21:23:55 GMT, Sean Mullan  wrote:

>> Martin Balao has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Limit P11Util::getProvider privileged access to the required 
>> 'accessClassInPackage' RuntimePermission only.
>>  - New line character inserted at the end of IllegalPackageAccess.java test 
>> file
>
> src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java line 
> 90:
> 
>> 88: p = Security.getProvider(providerName);
>> 89: if (p == null) {
>> 90: p = AccessController.doPrivileged(
> 
> Could you use the limited version of doPrivileged and only assert the 
> permissions that are strictly necessary to instantiate a provider?

Yes, makes sense. Thanks for your feedback.

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

2021-01-08 Thread Martin Balao
On Thu, 7 Jan 2021 19:29:29 GMT, Valerie Peng  wrote:

>> As described in JDK-8259319 [1], this fix proposal is to set proper access 
>> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
>> when a Security Manager is installed and the fallback scheme is used.
>> 
>> No regressions found in jdk/sun/security/pkcs11 tests category.
>> 
>> --
>> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319
>
> Obscure bug, thanks for report and the fix. I will take a look.

New proposal limiting the privileges in P11Util::getProvider method and adding 
a new line character at the end of the IllegalPackageAccess test file.

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes [v2]

2021-01-08 Thread Martin Balao
> As described in JDK-8259319 [1], this fix proposal is to set proper access 
> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
> when a Security Manager is installed and the fallback scheme is used.
> 
> No regressions found in jdk/sun/security/pkcs11 tests category.
> 
> --
> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319

Martin Balao has updated the pull request incrementally with two additional 
commits since the last revision:

 - Limit P11Util::getProvider privileged access to the required 
'accessClassInPackage' RuntimePermission only.
 - New line character inserted at the end of IllegalPackageAccess.java test file

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1961/files
  - new: https://git.openjdk.java.net/jdk/pull/1961/files/2fcfa69a..5e1e0a97

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=1961=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=1961=00-01

  Stats: 23 lines in 2 files changed: 10 ins; 0 del; 13 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1961.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1961/head:pull/1961

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

2021-01-08 Thread Valerie Peng
On Wed, 6 Jan 2021 15:33:59 GMT, Martin Balao  wrote:

> As described in JDK-8259319 [1], this fix proposal is to set proper access 
> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
> when a Security Manager is installed and the fallback scheme is used.
> 
> No regressions found in jdk/sun/security/pkcs11 tests category.
> 
> --
> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java line 102:

> 100: }
> 101: }
> 102: });

Sean's suggestion is to add additional arguments here, e.g. null, new 
RuntimePermission("accessClassInPackage." + ).

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

2021-01-08 Thread Valerie Peng
On Wed, 6 Jan 2021 15:33:59 GMT, Martin Balao  wrote:

> As described in JDK-8259319 [1], this fix proposal is to set proper access 
> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
> when a Security Manager is installed and the fallback scheme is used.
> 
> No regressions found in jdk/sun/security/pkcs11 tests category.
> 
> --
> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319

test/jdk/sun/security/pkcs11/KeyAgreement/IllegalPackageAccess.java line 96:

> 94: }
> 95: 
> 96: }

nit: add a newline here, to get rid of the red icon...

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

2021-01-07 Thread Sean Mullan
On Wed, 6 Jan 2021 15:33:59 GMT, Martin Balao  wrote:

> As described in JDK-8259319 [1], this fix proposal is to set proper access 
> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
> when a Security Manager is installed and the fallback scheme is used.
> 
> No regressions found in jdk/sun/security/pkcs11 tests category.
> 
> --
> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java line 90:

> 88: p = Security.getProvider(providerName);
> 89: if (p == null) {
> 90: p = AccessController.doPrivileged(

Could you use the limited version of doPrivileged and only assert the 
permissions that are strictly necessary to instantiate a provider?

-

PR: https://git.openjdk.java.net/jdk/pull/1961


Re: RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

2021-01-07 Thread Valerie Peng
On Wed, 6 Jan 2021 15:33:59 GMT, Martin Balao  wrote:

> As described in JDK-8259319 [1], this fix proposal is to set proper access 
> permissions so the SunPKCS11 provider can create instances of SunJCE classes 
> when a Security Manager is installed and the fallback scheme is used.
> 
> No regressions found in jdk/sun/security/pkcs11 tests category.
> 
> --
> [1] - https://bugs.openjdk.java.net/browse/JDK-8259319

Obscure bug, thanks for report and the fix. I will take a look.

-

PR: https://git.openjdk.java.net/jdk/pull/1961


RFR: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

2021-01-06 Thread Martin Balao
As described in JDK-8259319 [1], this fix proposal is to set proper access 
permissions so the SunPKCS11 provider can create instances of SunJCE classes 
when a Security Manager is installed and the fallback scheme is used.

No regressions found in jdk/sun/security/pkcs11 tests category.

--
[1] - https://bugs.openjdk.java.net/browse/JDK-8259319

-

Commit messages:
 - 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes

Changes: https://git.openjdk.java.net/jdk/pull/1961/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=1961=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259319
  Stats: 115 lines in 4 files changed: 105 ins; 0 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1961.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1961/head:pull/1961

PR: https://git.openjdk.java.net/jdk/pull/1961