Skip to content

Add defensive class validation during deserialization#85

Open
yannaingtun wants to merge 1 commit intosquirrel-sql-client:masterfrom
yannaingtun:fix-deserialization
Open

Add defensive class validation during deserialization#85
yannaingtun wants to merge 1 commit intosquirrel-sql-client:masterfrom
yannaingtun:fix-deserialization

Conversation

@yannaingtun
Copy link

This change adds a defensive safeguard to the deserialization logic in Utilities.cloneObject().

Previously, the custom ObjectInputStream.resolveClass() method loaded classes using Class.forName() without validating that the resolved class matched the expected object type. If untrusted or malformed serialized data were ever passed to this code path, this could allow unexpected classes to be resolved during deserialization.

The updated implementation verifies that the resolved class is compatible with the original object’s class and rejects incompatible classes early. This keeps the existing behavior for valid use cases while adding an extra layer of safety.

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