<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 12, 2024 at 1:20 PM Sean Mullan <<a href="mailto:sean.mullan@oracle.com">sean.mullan@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Xuelei,<br>
<br>
What value does a pluggable provider API provide? </blockquote><div dir="auto"><br></div><div dir="auto">With a public API, it is not necessary any longer for OpenJDK to maintain a filter syntax.  If the filter syntax is supported, it will require JDK to maintain and track the development of various crypto compliant policies.  If one cannot support FIPS or any other policies with the syntax, OpenJDK security team could be blamed and asked for a bug fix or enhancement.   There is nothing else application can do to customize the syntax except ask for help from OpenJDK security team.</div><div dir="auto"><br></div><div dir="auto">If the team ready to shoulder the responsibility to support known and unknown policies?  I am not sure.</div><div dir="auto"><br></div><div dir="auto">Xuelei </div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" dir="auto">Why would I want <br>
different implementations of an API that I want to use to disable SHA-1 <br>
for example? Why would I want to learn more than one way to configure <br>
them? The details are always going to be in how the filter is <br>
configured, so ideally you want one way to do that, and one time to <br>
learn it. I think this is also the type of feature you want to have a <br>
large amount of confidence that it does the right thing since it will be <br>
used for security purposes.<br>
<br>
I'm all for making the implementation simpler though. If there are API <br>
changes we can make to centralize the filtering through a simpler API <br>
(that perhaps is final, and not extensible) and not having to modify <br>
each engine class to call it, that would be great.<br>
<br>
--Sean<br>
<br>
On 12/12/24 3:55 PM, Xue-Lei Andrew Fan wrote:<br>
> On Mon, 2 Dec 2024 21:05:53 GMT, Martin Balao <<a href="mailto:mbalao@openjdk.org" target="_blank">mbalao@openjdk.org</a>> wrote:<br>
> <br>
>> getService/getServices API overrides are supported since the initial PR. Please check the JEP and implementation, and let us know if you see any flaw.<br>
> <br>
> I guess you refer to the following section in the JEP.  Otherwise, please let me know the correct JEP section.  That's the key point that I would like to address.  Without this concern, the issue could be simpler.<br>
> <br>
>> For third-party providers that override java.security.Provider::getService or java.security.Provider::getServices to return services that have not been evaluated against the filter or are evaluated and not allowed, a second filter enforcement occurs in java.security.Provider.Service::newInstance.<br>
> <br>
> For unknown providers that override the Provider::getService and Provider::getServices methods, I'm not sure how the filter could get them evaluated with the 1st filter.  For the 2nd filter, please refer to the next comment.<br>
> <br>
>> In rare situations, a third-party provider can override java.security.Provider.Service::newInstance and return an unvetted service implementation (SPI).<br>
> <br>
> Well, there is a concern of mine.  I don't agree the case is rare.  What if you are making a wrong judgment about it popularity here?  Did you have data to support your point.  How could you get the case covered even for the rare case even if it is really rare?<br>
> <br>
> With a new public API, for example ServicePermission.permit(Provider service).  I don't think you need the 2nd filter for  java.security.Provider.Service::newInstance any longer.  All you need is to updates the following 2 or 3 methods, plus a few bug fixes out of the scope of this JEP:<br>
>      provider.putService() (optional, for performance improvement only)<br>
>      provider.getService()<br>
>      provider.getServices()<br>
>    <br>
> And document the public API and have third party provider follow the spec and use the API.  Without a public API, there is not much we can do for unknown third party providers.   Even with the public API, third party's provider may not follow it.  But they now have a way to follow the spec, and application also have solutions for those that do not follow the new spec yet.<br>
> <br>
> Let's see the scenarios:<br>
> 1.  Define a public service API: ServicePermission.permit(Provider service), and a method to get the service so that it can be set with a security property (see #4).<br>
> 2. Update  provider.getService() and  provider.getServices(), and submit to JDK repository.<br>
> 3. Application implement the ServicePermission service, ThisIsMyFilterProvider (JDK could have a java.security property filter implementation in a new JEP, but it is not necessarily have any value in default JDK).<br>
> 4. Update java.security update, java.security.filter="ThisIsMyFilterProvider", default value is empty.<br>
> 5. Enjoy it.<br>
> <br>
>> are we going to have different syntax depending on the 3rd-party filter implementor?<br>
> No, there is not syntax to maintain at all, unless you want to define a specific ServicePermission provider.  You can do that with your proposal about the syntax for default JDK, and enforce it for your own proposal.  You don't want to worry about those applications that don't use your proposal:<br>
> java.security.filter=my-filter-Provider-with-my-loved-syntax<br>
> <br>
>> The problems of filtering by algorithm parameters and by use (e.g. MD5 for UUID) are not easy to solve, will require further discussion and are orthogonal to a pluggable filter.<br>
> No, it is not easy for your proposal.   But it is not that hard with a customizable ServicePermission.permit(Provider service) APIs.  I think smart developers could have it addressed for specific environment, so that we don't need to worry about them for a general approach for all environment.<br>
> <br>
> It looks like more simple, powerful and having actual requirements, is it?<br>
> <br>
> -------------<br>
> <br>
> PR Comment: <a href="https://git.openjdk.org/jdk/pull/15539#issuecomment-2539993473" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/15539#issuecomment-2539993473</a><br>
<br>
</blockquote></div></div>