Skip to content

Move marshmallow-jsonschema to optional dependency to fix CVE-2024-6345#3420

Open
dwo wants to merge 2 commits intoflyteorg:masterfrom
dwo:rt/bump-setuptools-for-cve
Open

Move marshmallow-jsonschema to optional dependency to fix CVE-2024-6345#3420
dwo wants to merge 2 commits intoflyteorg:masterfrom
dwo:rt/bump-setuptools-for-cve

Conversation

@dwo
Copy link
Copy Markdown

@dwo dwo commented Apr 9, 2026

Tracking issue

https://www.cve.org/CVERecord?id=CVE-2024-6345

Why are the changes needed?

setuptools was pinned <70 in #3388 as a runtime dependency solely because marshmallow-jsonschema imports pkg_resources at runtime.
This forces all flytekit users onto a setuptools version affected by CVE-2024-6345.

The marshmallow-jsonschema code path is only a fallback — mashumaro is the primary JSON Schema generator, and the marshmallow path only triggers when mashumaro fails for DataClassJsonMixin classes.
The imports are already guarded by try/except, so nothing breaks when the package is absent.

marshmallow-jsonschema itself appears unmaintained (last commit Oct 2023, multiple open PRs to remove pkg_resources unmerged).

An alternative would be to drop marshmallow-jsonschema support entirely, since mashumaro already covers the primary path.

What changes were proposed in this pull request?

  • Remove marshmallow-jsonschema, marshmallow-enum, and setuptools from core dependencies
  • Add a new marshmallow-jsonschema optional extra with those packages (setuptools>=70,<82)
  • Bump build-system setuptools to >=70
  • Update dev-requirements.in to install the extra for tests
  • Update docstring to reflect mashumaro as the primary JSON Schema generator

How was this patch tested?

Ran test_type_engine.py and test_generice_idl_type_engine.py — 416 passed, 2 skipped.

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

#3388

dwo and others added 2 commits April 9, 2026 11:25
setuptools was pinned <70 as a runtime dependency solely because
marshmallow-jsonschema imports pkg_resources. This blocks the fix for
CVE-2024-6345 (setuptools <70).

Since the marshmallow-jsonschema code path is only a fallback (mashumaro
is the primary JSON Schema generator), move marshmallow-jsonschema,
marshmallow-enum, and setuptools into an optional extra. The existing
try/except already handles the missing import gracefully.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Robin Tweedie <dwo@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Robin Tweedie <dwo@users.noreply.github.com>
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.

1 participant