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

fix: Handle exceptions raised by getters during parameter serialization #167

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

dustinbyrne
Copy link
Contributor

@dustinbyrne dustinbyrne commented Aug 1, 2024

This change addresses an issue where exceptions raised by getters during parameter serialization were not handled properly. A test case was added to ensure that the parameter function does not throw an error when encountering a "get" trap, and the isSimpleObject function was updated to catch exceptions and return false if an error occurs.

This pull request ensures stability when dealing with objects that have getters that could potentially throw exceptions, preventing crashes and ensuring that such objects are treated as non-simple.

E.g. https://github.com/nestjs/nest/blob/233a89ab3d84d814bb795f738be15216f5b30ed9/packages/common/module-utils/configurable-module.builder.ts#L331-L346

Fixes #158

This was spotted in the wild, where the getter was overwritten to make
sure an object was not used as a value.
@dustinbyrne dustinbyrne merged commit 3ca66af into main Aug 5, 2024
6 checks passed
@dustinbyrne dustinbyrne deleted the fix/handle-parameter-get-exception branch August 5, 2024 13:28
@appland-release
Copy link

🎉 This PR is included in version 2.23.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: "ASYNC_OPTIONS_TYPE" is not supposed to be used as a value.
3 participants