-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable Jackson default JSON processing limits #17854
Conversation
I tried to create smallest change possible |
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/JsonTypeUtil.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/JsonUtils.java
Outdated
Show resolved
Hide resolved
bcd058c
to
5abda7b
Compare
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/DefaultJsonFactory.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/DefaultJsonFactory.java
Outdated
Show resolved
Hide resolved
service/trino-verifier/src/main/java/io/trino/verifier/JsonEventClient.java
Outdated
Show resolved
Hide resolved
f8f79a5
to
e6ee843
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good % comments.
re: allowing default factory on serialization paths - we won't know when code is introduced in the serialization places which also does de-serialization. Why not use the no-limits JsonFactory in serialization path as well - doesn't seem to hurt?
testing/trino-benchmark/src/main/java/io/trino/benchmark/JsonBenchmarkResultWriter.java
Outdated
Show resolved
Hide resolved
testing/trino-benchmark/src/main/java/io/trino/benchmark/OdsBenchmarkResultWriter.java
Outdated
Show resolved
Hide resolved
e6ee843
to
3483904
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/DefaultJsonFactory.java
Outdated
Show resolved
Hide resolved
lib/trino-hive-formats/src/main/java/io/trino/hive/formats/line/json/JsonSerializer.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/DefaultJsonFactory.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/PartitionData.java
Outdated
Show resolved
Hide resolved
3483904
to
c340024
Compare
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
c340024
to
d723f00
Compare
added "Fixes #17843" in the description |
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
#17854 (comment) is resolved, please help me understand what the resolution is. |
@findepi disallow mutating already configured JsonFacfory. Instead you should use a builder if you want a different configuration. This makes it easier to reason about factories that are used since they configuration is immutable in the runtime |
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
82e38e3
to
e27855f
Compare
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/TrinoJsonFactory.java
Outdated
Show resolved
Hide resolved
e27855f
to
5a4aac1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Provide safe way to create JsonFactories"
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/JsonUtils.java
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/test/java/io/trino/plugin/base/util/TestJsonUtils.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/test/java/io/trino/plugin/base/util/TestJsonUtils.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/test/java/io/trino/plugin/base/util/TestJsonUtils.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/test/java/io/trino/plugin/base/util/TestJsonUtils.java
Outdated
Show resolved
Hide resolved
lgtm % |
5a4aac1
to
a9dbb01
Compare
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/util/JsonUtils.java
Show resolved
Hide resolved
CI checkstyle failure looks related |
b929265
to
48e5c93
Compare
Jackson 2.15 introduced read constraints that are meant to protect deserialization path from deeply nested/long string JSON documents. Introduced limits are too small for Trino to work properly. Airlift is already disabling those limits when ObjectMapperProvider is used. Additionaly ban direct usage of JsonFactory and JsonFactoryBuilder. Instead JsonUtils.jsonFactory() or JsonUtils.jsonFactoryBuilder() should be used.
48e5c93
to
89c61de
Compare
Description
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:
Fixes #17843