Skip to content

Upgrade to Jackson 3.x#2427

Merged
dadoonet merged 4 commits into
masterfrom
2419-jackson-3
Jul 5, 2026
Merged

Upgrade to Jackson 3.x#2427
dadoonet merged 4 commits into
masterfrom
2419-jackson-3

Conversation

@dadoonet

@dadoonet dadoonet commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Closes #2419

Summary

Migrates FSCrawler from Jackson 2.22 to Jackson 3.1.4.

  • BOM group id com.fasterxml.jacksontools.jackson (3.1.4). Annotations intentionally stay on com.fasterxml.jackson.core:jackson-annotations (2.x line), per the Jackson 3 design.
  • Gestalt config switched to its Jackson 3 modules (gestalt-yaml-jackson3, gestalt-json-jackson3) so it shares FSCrawler's Jackson 3 instead of pulling its own Jackson 2 line.
  • A com.fasterxml.jackson:jackson-bom (2.22.0) import is kept to pin the Jackson 2.x still pulled transitively by Tika (jackson-databind) to a patched release; the same version feeds the Spotless formatter.
  • JsonUtil mappers rebuilt through the new immutable builder API (JsonMapper.builder(), YAMLMapper.builder()). JavaTimeModule/jsr310 dropped — java.time support is now built into jackson-databind. setDefaultPropertyInclusion(NON_EMPTY) is reproduced by setting both value and content inclusion to NON_EMPTY.
  • Custom (de)serializers migrated (SerializationContext, tools.jackson.* packages, JsonParser.getString()).
  • Jackson exceptions are now unchecked (JacksonException); adapted throws/catch in JsonUtil, FsSettingsParser, DocUtils, XmlDocParser. JsonNode.fieldNames()properties().
  • REST layer: replaced Jersey's JacksonFeature (Jackson 2) with the Jackson 3 JAX-RS provider tools.jackson.jakarta.rs:jackson-jakarta-rs-json-provider. The Jackson 3 provider resolves its mapper via ContextResolver<JsonMapper>, so RestJsonProvider is typed on JsonMapper (otherwise the provider falls back to a default mapper and drops the custom serializers). Removed the now-unused jersey-media-json-jackson from the FSCrawler modules. Migrated the REST integration-test clients accordingly.

Behaviour change (documented in release notes)

Jackson 3 serializes bean properties alphabetically by default. We adopt this default, so indexed documents, generated _settings.yaml / _checkpoint.json, and REST API responses now have their fields ordered alphabetically. Purely cosmetic. Documentation examples of FSCrawler-generated output were updated to match; Tika meta.raw maps are unaffected.

Security

Jackson 3.1.2/3.1.3 are affected by CVE-2026-54512 / CVE-2026-54513 (PolymorphicTypeValidator bypass), fixed in 3.1.4 — hence the target version. The transitive Jackson 2 (Tika) is pinned to 2.22.0 (outside the vulnerable range). FSCrawler does not use polymorphic deserialization, but the OSS Index audit (score ≥ 7.0) correctly blocks the vulnerable versions.

Test plan

  • mvn clean test-compile — full reactor compiles (20 modules)
  • mvn test -DskipIntegTests — all unit tests green
  • mvn spotless:check — green
  • mvn verify OSS Index dependency audit — green (no vulnerable components)
  • FsCrawlerRestIT — full class (14 tests) green against a TestContainers Elasticsearch, exercising GET /, document upload, external tags and crawler control end-to-end

🤖 Generated with Claude Code

- Migrate group id com.fasterxml.jackson → tools.jackson (BOM 3.1.2); annotations stay on com.fasterxml.jackson
- Rebuild JsonUtil mappers via the immutable builder API; drop JavaTimeModule (java.time is built into databind)
- Adapt custom (de)serializers, unchecked exceptions (JacksonException), JsonNode.properties(), XmlMapper builder
- Replace Jersey JacksonFeature with the Jackson 3 JAX-RS provider (tools.jackson.jakarta.rs); drop unused jersey-media-json-jackson from the FSCrawler modules
- Serialized JSON/YAML now orders fields alphabetically (Jackson 3 default); update unit tests and documentation examples accordingly
- Keep Spotless pinned to Jackson 2.x

Closes #2419

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

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@mergify

mergify Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

- Bump Jackson to 3.1.4: 3.1.2/3.1.3 are vulnerable to CVE-2026-54512 / CVE-2026-54513
  (PolymorphicTypeValidator bypass, fixed in 3.1.4), which the OSS Index audit flags
- Re-import the Jackson 2.x BOM (2.22.0) to pin the Jackson 2 jackson-databind still pulled
  transitively (Gestalt) to a patched release; consolidated with the Spotless Jackson version
- Restore the Jackson 2 semantics of setDefaultPropertyInclusion(NON_EMPTY): also apply NON_EMPTY
  to content inclusion so empty map/collection values are omitted. Without it, the re-serialized
  Elasticsearch _source kept empty objects (e.g. "meta":{}), breaking
  FsCrawlerRestIT#documentWithExternalTags

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

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

- Switch gestalt-yaml / gestalt-json to gestalt-yaml-jackson3 / gestalt-json-jackson3 so Gestalt uses
  the same Jackson 3 (tools.jackson) as FSCrawler instead of pulling its own Jackson 2 line
- Keep the com.fasterxml.jackson:jackson-bom (2.22.0) import: Jackson 2 is still pulled transitively by
  Tika (jackson-databind), so it must be pinned to a patched release for the OSS Index audit

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

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

The Jackson 3 Jakarta-RS provider resolves its mapper via ContextResolver<JsonMapper> (not
ObjectMapper), so the ObjectMapper-typed RestJsonProvider was never picked up: the provider fell
back to a default mapper and dropped the fscrawler module's custom (de)serializers. This made
GET / serialize ByteSizeValue / TimeValue as objects instead of strings, breaking client-side
deserialization (FsCrawlerRestIT#callRoot).

- RestJsonProvider now implements ContextResolver<JsonMapper>
- JsonUtil.mapper / prettyMapper are typed as JsonMapper (they already are JsonMapper instances)

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

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@dadoonet dadoonet merged commit 7dde242 into master Jul 5, 2026
17 checks passed
@dadoonet dadoonet deleted the 2419-jackson-3 branch July 5, 2026 20:34
@dadoonet dadoonet self-assigned this Jul 5, 2026
@dadoonet dadoonet added update When updating an existing feature dependencies Pull requests that update a dependency file labels Jul 5, 2026
@dadoonet dadoonet added this to the 2.10 milestone Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file update When updating an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update to jackson 3.x

1 participant