JSON union reader checks only the last unknown field, so field order decides
Mantenedores costumam responder em até 3 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- Meio dia
- Facilidade para iniciantes
- 68/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 103
- Forks
- 23
- Merge médio
- 5d 8h
- PRs com merge (30d)
- 3
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de Backblaze/b2-sdk-java
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Backblaze/b2-sdk-java#248 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Backblaze/b2-sdk-java#247 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Backblaze/b2-sdk-java#246 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Backblaze/b2-sdk-java#245 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Backblaze/b2-sdk-java#242 ·
Mantenedores costumam responder em até 3 dias
Todas as issues de Backblaze/b2-sdk-java
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
IETF-Hackathon/pqc-certificates#351 ·
Mantenedores costumam responder em até 2 dias
-
bug(core): skip_nodes.json is missing SELECT and PRE, causing Python and Java to insert separators into dropdown options and preformatted textTalvez já em andamento @Bhumit267 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
ExceptionThrowShouldUseContext: NullPointerException on a catch block inside an annotation typeTalvez já em andamento @Carbon14-48 assumiu hoje. Abertaapproved
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
checkstyle/checkstyle#22784 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia