Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added invalid serialization/unserialization detector #78

Closed
wants to merge 1 commit into from

Conversation

jaredoconnell
Copy link
Contributor

@jaredoconnell jaredoconnell commented Feb 14, 2024

Changes introduced with this PR

Fixes #63

In the past, bugs were introduced due to unserializing a type twice. There wasn't a way to detect that before. With the schema type added in this PR, it can just be added to a property to detect double serialization or unserialization.

This type is purely for detecting invalid uses.


By contributing to this repository, I agree to the contribution guidelines.

Copy link
Contributor

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

This seems reasonable (although, it's mildly unsatisfying that unserializing serialized input (or serializing unserialized input, whichever) doesn't produce the original value).

However, looking at how this is used in arcalot/arcaflow-engine#153, I don't see any compelling reason why this needs to be in a standalone module in the arcaflow-plugin-sdk-go repo. This could be inserted into workflow/workflow_test.go (or imported into it from an "adjacent" file) and referenced directly.

So, I would recommend against merging this PR.

Comment on lines +51 to +53
func (d InvalidSerializationDetectorSchema) ValidateCompatibility(_ any) error {
// Not applicable to this data type
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

If this function is not applicable, why does it return "no-error"? It seems like it should either return an error (claiming that it is not applicable and/or that it should not have been called) or it should panic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just doesn't validate compatibility because it's out of scope of its purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, the comment that this function is "not applicable to this data type" is not accurate...instead, it's more the case either that this data type is never incompatible or that we just don't care...and, regardless, the action here is to never return an error when the check is made.

@jaredoconnell
Copy link
Contributor Author

jaredoconnell commented Feb 21, 2024

Moved to arcalot/arcaflow-engine#153.

@jaredoconnell jaredoconnell deleted the invalid-serialization-detector branch February 21, 2024 23:41
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.

Detect double-serialization/unserialization
2 participants