Default JSON mapper collection limit is hard-coded and replaces all collection deserialization
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 22/100
Piste de recherche
Read the JacksonMapper bean method in ContextFunctionCatalogAutoConfiguration first, then CollectionLimitModule and LimitedCollectionDeserializer to see how the deserializer modifier replaces every Collection deserializer. There is no test coverage today, so start by writing a failing test that deserializes a LinkedList and a TreeSet through the default mapper, plus one that exceeds the limit. Done means the limit is configurable, the requested collection type and any pre-existing deserializer are preserved by delegation, violations surface as Jackson exceptions, and the Joda UTCProvider call no longer depends on the fallback path.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
The default JacksonMapper created in ContextFunctionCatalogAutoConfiguration registers CollectionLimitModule, whose deserializer modifier replaces the deserializer of every Collection type with LimitedCollectionDeserializer. This has several problems:
- the limit is a constant (
MAX_ITEMS = 1000) and can not be configured, so a legitimate batch with more than 1000 elements fails - the failure is a plain
IllegalStateException("Collection size exceeds limit of 1000")rather than a Jackson exception, so it is not handled like other deserialization errors - the deserializer always creates an
ArrayList, or aHashSetforSettypes, regardless of the requested type, soLinkedList,TreeSet,LinkedHashSet(order is lost),ArrayDequeand similar targets do not get the collection type that was asked for - any custom or more specific collection deserializer, including ones registered on the user's
ObjectMapperthat the mapper is rebuilt from, is replaced, because the modifier ignores the deserializer it is given - the deserializer reads elements with
getBoundType(0)of the declared type and does not handlenulltokens, polymorphic type information or a start token that is not an array
There are no tests for LimitedCollectionDeserializer or CollectionLimitModule.
Separately, when no ObjectMapper bean can be rebuilt, the fallback in the same method calls DateTimeZone.setProvider(new UTCProvider()), which changes the Joda time zone provider for the whole JVM depending on whether a bean was present.
Proposed change: make the limit configurable (or use Jackson's own stream read constraints), keep the requested collection type and any existing deserializer by delegating to it, throw a Jackson exception on violations, and add tests for the cases above. The Joda provider change should not depend on the fallback path.
- Langage dominant
- Java
- Étoiles
- 1.1k
- Forks
- 655
- Merge moyen
- 4 h 54 min
- PR mergées (30 j)
- 10
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de spring-cloud/spring-cloud-function
-
ClassCastException with spring-cloud-function 4.3.6 when a field of type Set is deserializedOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
spring-cloud/spring-cloud-function#1542 ·
Les mainteneurs répondent en général sous 1 jour
-
GcfJarLayout omits GcfJarLauncher$NestedUrlStreamHandlerFactory, causing NoClassDefFoundError under the GCF invokerPeut-être pris @zemiles l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 32/100
spring-cloud/spring-cloud-function#1544 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
spring-cloud/spring-cloud-function#1538 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Kotlin function wrapper treats empty input as no inputPeut-être pris @seonwooj0810 l’a pris aujourd’hui. Ouverte5.0.x backport bug
Difficulté 3/5 Une demi-journée Accessibilité débutants 30/100
spring-cloud/spring-cloud-function#1537 ·
Les mainteneurs répondent en général sous 1 jour
-
SmartCompositeMessageConverter fails with NullPointerException or ClassCastException in several conversion pathsPeut-être pris @seonwooj0810 l’a pris il y a 1 jour. Ouverte5.0.x backport bug
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
spring-cloud/spring-cloud-function#1535 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de spring-cloud/spring-cloud-function
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
bug devops low
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
-
enhancement
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
MDMesh-app/MDMesh#252 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 80/100
Les mainteneurs répondent en général sous 1 jour