JSON union reader checks only the last unknown field, so field order decides
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 68/100
Línea de trabajo
Start in core/src/main/java/com/backblaze/b2/json/B2JsonUnionBaseHandler.java. Read the read loop around line 350, where unknownFieldNameOrNull is overwritten on each unknown field, and the check after the loop around line 384. Add a test that deserializes an object with two unknown fields in both orders under ERROR mode, with a discard list, and confirm the outcomes differ. It is done when both orders give the same, correct result and the test passes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
While reading a union object with ExtraFieldOption.ERROR, each unknown field overwrites a single unknownFieldNameOrNull variable, and only the last one is checked against the fields that may be discarded. If an object has two unknown fields, a non-discardable unknown field that comes before a discardable one is accepted, so the result depends on field order.
Where
core/src/main/java/com/backblaze/b2/json/B2JsonUnionBaseHandler.java:350 (assignment in the read loop) and :384 (the check after the loop).
Why it matters
Impact: Wrong request or result (an unknown field is accepted that should be rejected), silent when accepted. Severity: Medium, because it needs ERROR mode, a discard list and two or more unknown fields (unusual), and the SDK's own responses are read in the lenient mode.
How to check
Found by reading the code, not reproduced. Read the loop and the check after it. A test could deserialize {"type":"x","bad":1,"discardable":2} and the same object with the two fields swapped, with ERROR mode, and compare the outcomes. Collecting all unknown names, or checking each one as it is read, would fix it.
Version
Seen at v6.5.0. Present on the default branch: present.
- Lenguaje dominante
- Java
- Estrellas
- 103
- Forks
- 23
- Merge medio
- 5 d 8 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Backblaze/b2-sdk-java
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Backblaze/b2-sdk-java#248 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Backblaze/b2-sdk-java#247 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Backblaze/b2-sdk-java#246 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Backblaze/b2-sdk-java#245 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Backblaze/b2-sdk-java#242 ·
Los mantenedores suelen responder en 3 días
Todos los issues de Backblaze/b2-sdk-java
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
IETF-Hackathon/pqc-certificates#351 ·
Los mantenedores suelen responder en 2 días
-
bug(core): skip_nodes.json is missing SELECT and PRE, causing Python and Java to insert separators into dropdown options and preformatted textPosiblemente ocupada @Bhumit267 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
ExceptionThrowShouldUseContext: NullPointerException on a catch block inside an annotation typePosiblemente ocupada @Carbon14-48 la tomó hoy. Abiertoapproved
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
checkstyle/checkstyle#22784 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día