bug: expression JSON deserialization throws an uncaught exception on a non-string "type"/"term"
Mantenedores costumam responder em até 2 dias
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 75/100
Direção de pesquisa
Start in src/iceberg/expression/json_serde.cc and compare the unguarded type/term checks with OperationTypeFromJson and util/json_util_internal.h. Trace the metadata path through FieldFromJson in src/iceberg/json_serde.cc and the REST filter entry points mentioned in metrics/json_serde.cc and catalog/rest/json_serde.cc. Done means non-string discriminators return JsonParseError rather than escaping as nlohmann exceptions.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
The expression JSON deserialization functions in src/iceberg/expression/json_serde.cc call json[kType].get<std::string>() (and one json[kTerm].get<std::string>()) guarded only by is_object() and contains(kType). When "type" or "term" is a number, bool, null, or array, nlohmann throws json::type_error.302. These functions return Result<...> and the expression parse chain has no try/catch, so the exception escapes the Result contract and terminates any caller that lacks an exception barrier.
Root Cause
The unguarded get<std::string>() calls sit behind only is_object() && contains(kType): IsTransformTerm, NamedReferenceFromJson (both the type and the term node), both LiteralFromJson overloads' wrapper check, and ExpressionFromJson. The sibling OperationTypeFromJson already checks is_string() first, and util/json_util_internal.h exists precisely to convert nlohmann throws into JsonParseError. The unguarded sites are the outliers, not the policy.
Impact
These parsers run on real deserialization paths, all through ICEBERG_ASSIGN_OR_RAISE, which forwards a Result error but not a thrown exception. Table-metadata parsing is the live path today: FieldFromJson (src/iceberg/json_serde.cc) parses a field's initial-default / write-default through the type-aware LiteralFromJson, so a metadata file whose default is wrapped as {"type": <non-string>, "value": ...} throws instead of returning a parse error — the same path #877/#878 hardened. REST catalog responses reach the expression sites too: the scan-metrics report filter (metrics/json_serde.cc) and the residual, partition, and plan filters (catalog/rest/json_serde.cc) all parse server-supplied JSON. A non-string discriminator on any of these throws type_error.302 out of a Result-returning function and past the ICEBERG_ASSIGN_OR_RAISE call site, which is the same uncaught-exception-escaping-Result class as the merged #857.
Per SECURITY-THREAT-MODEL.md, catalog-supplied metadata is trusted input, so this is a robustness and contract issue, not a security one.
Proposed Fix
Add an is_string() check to each guard so a non-string type/term returns JsonParseError, mirroring OperationTypeFromJson.
- Linguagem predominante
- C++
- Estrelas
- 228
- Forks
- 136
- Merge médio
- 5d 19h
- PRs com merge (30d)
- 53
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 apache/iceberg-cpp
-
bug: TableMetadataBuilder::RemoveSchemas leaves removed ids in the schema indexTalvez já em andamento @LuciferYang assumiu há 5 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/iceberg-cpp#1011 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 12/100
apache/iceberg-cpp#1027 ·
Mantenedores costumam responder em até 2 dias
-
bug: gzip table metadata is neither written nor detected as gzipTalvez já em andamento @LuciferYang assumiu há 5 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 66/100
apache/iceberg-cpp#1013 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
apache/iceberg-cpp#1000 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 8/100
apache/iceberg-cpp#988 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
Todas as issues de apache/iceberg-cpp
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
[BUG] Clipboard History: Buffer over-read in WideCharToMultiByte on double-click pasteTalvez já em andamento @softmgr assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
notepad-plus-plus/notepad-plus-plus#18519 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
justcallmekoko/ESP32Marauder#1635 ·
Mantenedores costumam responder em até 1 dia
-
3.7.6-dev commit 80481ea - files not centered when resolution differs and zoom = "pixel-to-pixel"Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
grizzlypeak3d/DJV#931 ·