Skip to content

Add JsInterpreter to replace Rhino usage#2812

Open
Luna712 wants to merge 15 commits into
recloudstream:masterfrom
Luna712:jsinterpreter
Open

Add JsInterpreter to replace Rhino usage#2812
Luna712 wants to merge 15 commits into
recloudstream:masterfrom
Luna712:jsinterpreter

Conversation

@Luna712

@Luna712 Luna712 commented May 20, 2026

Copy link
Copy Markdown
Contributor

I added 158 test cases for this, all of which pass locally. When adding tests I specifically targeted some common uses of rhino by extensions, and additionally added things extensions may want or need to use in the future. We can also expand those tests should something else come up in the future.

@Luna712 Luna712 marked this pull request as ready for review May 25, 2026 18:54
@Luna712

Luna712 commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

This should now be ready for review. I ran all the tests and they worked, fixed a couple things, and added a simpler API.

@fire-light42 fire-light42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the JS interpreter does not handle the JSFuck obfuscation technique, which abuses easily overlooked parts of standard JS to obfuscate code, it should be very easy to generate test cases.

Would it be possible to support this or would it be too much scope creep? Even if it cannot be fully supported it might reveal some easy-to-fix edge cases.

@Luna712

Luna712 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

It should be possible to support it although I am not entirely sure how at the moment. I aimed for this to support a lot of the standard JS spec, and didn't really go beyond it. I tried to support everything I found extensions using Rhino for and added test cases for some of those uses. I think if we do support it, we can, but perhaps should be a separate PR as that is kinda a different scope then what this was aiming for but up to you, I could look more into this this weekend though if you want.

@fire-light42

Copy link
Copy Markdown
Collaborator

I will also do some testing on the real-world usage of the JS helpers to determine if this is required. Currently it does not seem like a blocker.

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.

2 participants