Skip to content

Implement ObjectInputFilter allowlist for legacy object deserialization - #838

Open
AliRana30 wants to merge 1 commit into
apache:mainfrom
AliRana30:fix/object-input-filter-835
Open

AliRana30 wants to merge 1 commit into
apache:mainfrom
AliRana30:fix/object-input-filter-835

Conversation

@AliRana30

Copy link
Copy Markdown
Contributor

What changes?

  1. ObjectFileSerialization:
    • Adds createObjectInputFilter(Class<?> elementType) to restrict legacy object deserialization to expected primitives, wrappers, standard safe collections, Wayang types, Scala tuples, and expected elementType hierarchies.
    • Adds dynamic allowlist pattern configuration via wayang.basic.serialization.allowlist.
    • Rejects unauthorized classes with InvalidClassException.
  2. WayangValue:
    • Enforces the ObjectInputFilter on Flink criterion deserialization.
    • Refactors convertToByte and convertToObject to use try-with-resources.
  3. Tests:
    • Added unit test cases to verify rejection of disallowed classes, explicit elementType acceptance, and system property pattern matching.

Why are the changes needed?

Directly calling ObjectInputStream.readObject() without an ObjectInputFilter allows arbitrary class instantiation, posing a deserialization security risk (CWE-502).

How was this tested?

  • Unit tests added to ObjectFileSerializationTest and WayangValueTest.
  • Ran mvn test on wayang-basic and wayang-flink.
  • Ran mvn apache-rat:check.

Closes : #835

Copilot AI balanced review requested due to automatic review settings October 10, 2026 23:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AliRana30

Copy link
Copy Markdown
Contributor Author

@zkaoudi Pr is up for your review.

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.

[Improvement] Implement ObjectInputFilter allowlist for legacy object deserialization

2 participants