Skip to content

KYLIN-6092 Add polymorphic type validator for secure JSON deserialization - #2354

Open
jlfsdtc wants to merge 4 commits into
apache:kylin5from
jlfsdtc:KYLIN-6092
Open

KYLIN-6092 Add polymorphic type validator for secure JSON deserialization#2354
jlfsdtc wants to merge 4 commits into
apache:kylin5from
jlfsdtc:KYLIN-6092

Conversation

@jlfsdtc

@jlfsdtc jlfsdtc commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Event, SegmentRange and BroadcastEventReadyNotifier use @JsonTypeInfo(Id.CLASS), which lets an attacker-supplied @Class id load arbitrary classes (deserialization gadget attack). Set a BasicPolymorphicTypeValidator that only allows org.apache.kylin.* subtypes on the JsonUtil mappers and on the Spring HTTP converter ObjectMapper in AppConfig.

…e during JSON deserialization

Event, SegmentRange and BroadcastEventReadyNotifier use
@JsonTypeInfo(Id.CLASS), which lets an attacker-supplied @Class id load
arbitrary classes (deserialization gadget attack). Set a
BasicPolymorphicTypeValidator that only allows org.apache.kylin.*
subtypes on the JsonUtil mappers and on the Spring HTTP converter
ObjectMapper in AppConfig.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pjfanning

Copy link
Copy Markdown
Member

Change looks promising.
There are other places where new ObjectMappers are created. Are we sure that the changes in this PR are the only ones that need the PolymorphicTypeValidator?

https://github.com/search?q=repo%3Aapache%2Fkylin+new+ObjectMapper&type=code

Not all of the mappers in the search results are test cases.

- BaseSchedulerTest: stop the scheduler and wait for JobWorker threads to
  unwind before cleanup, so a lingering worker does not steal driver memory
  from the next test's baseline (ResourceAcquirer's semaphore is static).
- KylinConfigBaseTest: compare ext jar paths order-insensitively.
- .gitignore: exclude UT temp files and generated query result artifacts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jlfsdtc

jlfsdtc commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

You right. I will replace ObjectMappe with JsonUtil later for standardize usage

jlfsdtc and others added 2 commits August 20, 2026 14:09
Route JSON reads/writes through JsonUtil so they inherit the shared
polymorphic type validator instead of using raw ObjectMapper instances.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Broaden the .gitignore patterns to cover all *.sql.json/*.sql.schema under
kylin-it test resources and remove the ones already tracked.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jlfsdtc

jlfsdtc commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Draft: UT cache files will be modified subsequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants