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

CASL extra function "packRules" never throws when the received value is not expected #705

Closed
balboFK opened this issue Nov 21, 2022 · 3 comments
Labels

Comments

@balboFK
Copy link

balboFK commented Nov 21, 2022

Describe the bug
If you try to use CASL extra function packRules with an primitive that is not expected like: [{}] it never throws and consumes all you CPU, might get into a infinite loop or something but it never throws or finishes.

To Reproduce

  1. Just instantiate the CASL extra and call packRules with an object array like : [{}]

Expected behavior
Should throw or finish executing since the data is not workable for the packRules function

Interactive example (optional, but highly desirable)
https://codesandbox.io/s/sleepy-worker-bq7uwc?file=/src/index.js

CASL Version
@casl/ability - v^6.3.1

Environment:
Node: 16.14.2

@balboFK balboFK added the bug label Nov 21, 2022
@stalniy
Copy link
Owner

stalniy commented Nov 22, 2022

Good catch. It will never throw. It relies on typescript types to receive proper arguments shape.

But I agree that it shouldn’t run infinitely. I’ll fix that

@balboFK
Copy link
Author

balboFK commented Nov 22, 2022

Nice! I'll wait for it, thanks for the reply!

@stalniy stalniy closed this as completed in a19bd09 Dec 8, 2022
@stalniy
Copy link
Owner

stalniy commented Dec 8, 2022

fixed in @casl/ability@6.3.3

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

No branches or pull requests

2 participants