Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jsonb-dev] [External] : Refine polymorphic API
  • From: David Kral <david.k.kral@xxxxxxxxxx>
  • Date: Thu, 9 Dec 2021 14:47:02 +0000
  • Accept-language: cs-CZ, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pGOM0eWd95W20cgi1p75Q7hE5T7damFgHpMr2jmmyzQ=; b=ndFN1tnb4CdGocHthQOwYtBVEZY6+1ziayyA/puSY4M5MNKS511mWqT/xh+IjJS4Hk3k0mod8V1NM0WToE0rMaJEoGdezU4Z37zLSHiqaxciZ6rBHnyOSo8+u+pr/sxQsjDw814fJ3ozn7NmQPWRkMgaIEnLmq1h8WLYm8CeZ8kECKjh7GUeNfcEZk8sOP1iYweVxUottQQnwli9ymX6Vk6mAB3TOacTDx+9vqRCWVyGyx3yEVY4csx6Sr6ZVF1y2ogoaDPUodNyFxy1ojArNqMLeBR94AKPQQafvzj6n/4RutyqSOZnoktZHbBlNYps3stmdu87Lzx4pxHMptZq+g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LScufbZVgv9Ngh0hWCBV4d9rmPtPV1F2JH/LDWg8rmTCo+RJ3UBlpIJAVURzK9O5UiPHQ8YjHtYS2pp6SZRzpmcX5SD4byMSMhWql7aAK+/bZ5oTs0sZm54ikEn0oMjddLOD46ol51zshPn5XUNi63VwBKER1URqkqyfgLMtYY453tAVslK2RWS7lqXvRERCWqkFYkZfFzhh5jiQdToBURbWqVTOocH705YPABhD+ETnYOaXv5qnvf5EQybVPg1T0x6OmstqSe6FW/9SpDpJltNUOR08Vl7uRzPi0UbZ2PDem7eEa7tE4OQuM2llk4iyc8xBDdzvizrrpUOVln32ZQ==
  • Delivered-to: jsonb-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jsonb-dev/>
  • List-help: <mailto:jsonb-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jsonb-dev>, <mailto:jsonb-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jsonb-dev>, <mailto:jsonb-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHX7PhSsEVU3MWWDUeg1PM0QyNNyKwqOgOw
  • Thread-topic: [jsonb-dev] [External] : Refine polymorphic API

In terms of 301, I do agree with you just in about 30% of your opinion there. But since we really need to finally make the API ready and compatible impl needs to be ready also upon the API release, I am OK with dropping this 301 and 302…

 

David

 

Od: jsonb-dev <jsonb-dev-bounces@xxxxxxxxxxx> za uživatele Romain Manni-Bucau
Odesláno: čtvrtek 9. prosince 2021 13:28
Komu: jsonb developer discussions <jsonb-dev@xxxxxxxxxxx>
Předmět: Re: [jsonb-dev] [External] : Refine polymorphic API

 

commented inline


Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book

 

 

Le jeu. 9 déc. 2021 à 12:38, David Kral <david.k.kral@xxxxxxxxxx> a écrit :

Hi Romain,

 

  1. 301
    Yes, that is an issue, but I do not see the problem there if it is disabled by default and if allowed packages are required by the spec to be set. That’s exactly what the spec requires. In that case it is reasonably secure since it must be allowed by the user explicitly. Impl should not load the class until it verifies that the class is in the allowed package.

 

RMB: verifying the package is not secured enough - and once again you can find it out there for backward compat reasons mainly. Being explicit or not does not help (unsecured=true will be the first thing you do if something prevents you do more forward, right), so let's just drop it, will not prevent any use case the spec does not handle so no reason to add backdoors. Feel free to add some yasson property to complete the spec feature if you feel it is needed.

 

  1. 302
    I will be honest here; I am not sure what API duplication are you talking about. I do not see anything wrong about adding this functionality. From my point of view, there is nothing wrong with having the format done over the enum.

Think one step further, format must not be an enum but a SPI so you define Format SPI....and get back to (de)serializer API so no need of that at all, it is a quick/fix design the spec does not need and shouldn't have to stay simple and efficient instead of polluted by duplicated concepts (which tends to kill API when selected).

 

David

 

Od: jsonb-dev <jsonb-dev-bounces@xxxxxxxxxxx> za uživatele Romain Manni-Bucau
Odesláno: čtvrtek 9. prosince 2021 11:40
Komu: jsonb developer discussions <jsonb-dev@xxxxxxxxxxx>
Předmět: [External] : [jsonb-dev] Refine polymorphic API

 

Hi all,

 

opened 2 issues we should tackle before next release on polymorphic topic:

 

 

Long story short we should ensure we are not dynamic at all on the types (301). This kind of behavior was introduced in existing (de)serialization libraries to mitigate the 0-day issue but it is not a solution so let's stick to a clean design for our first release please.

 

The other issue (302) is mainly about not wanting to do too much at first release and opening the door to a design we'll regret in release N+1 since we will get back to another duplication of API.

 

Overall our API should stick to:

 

@JsonbAnnotation

@Retention(RetentionPolicy.RUNTIME)

@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE})

public @interface JsonbPolymorphicType {

 

    /**

     * Key used for keeping polymorphic information when {@link Format#PROPERTY} is chosen.

     * Default value is {@code @type}.

     *

     * @return key name

     */

    String key() default "";

    /**

     * Allowed aliases of the given polymorphic type.

     *

     * @return list of allowed aliases

     */

    JsonbSubtype[] value() default {};

 

}

 

Overall it is way more important to ensure we can use (de)serializer in a portable manner to handle these requirements than addind and adding similar API which never cover all the users requirements so let's stay robust and simple and work on real underlying issues (keep in mind we worked on that before (de)serializers behavior was not defined enough originally so it is not only syntaxic sugar because we didn't do our homework ;)).


Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book

_______________________________________________
jsonb-dev mailing list
jsonb-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jsonb-dev


Back to the top