Skip to content

Conversation

@imReker
Copy link

@imReker imReker commented Sep 5, 2022

When worker set to true, convert transformHeader function to string, so the config could be cloned to worker and convert back in worker thread by eval.
So, when using Content Security Policy, this workaround will still fail, consider to use vkThread instead.

When worker set to true, convert transformHeader function to string, so the config could be cloned to worker and convert back in worker thread by `eval`.
So, when using Content Security Policy, this workaround will still fail, consider to use vkThread instead.
@pokoli
Copy link
Collaborator

pokoli commented Sep 5, 2022

I'm a little bit worried about the eval function as string specially as anyone can manipulate the string definition and then inject malicious code on the worker.

This raises a BIG WARNING on my mind.

Can we avoid using eval?

@imReker
Copy link
Author

imReker commented Sep 5, 2022

I'm a little bit worried about the eval function as string specially as anyone can manipulate the string definition and then inject malicious code on the worker.

This raises a BIG WARNING on my mind.

Can we avoid using eval?

Yes, there are potential risks. But the transformHeader usually doesn't come from dynamic user input, and the eval is running in the worker, so only global data and codes could be executed. Maybe a big notice in the document is needed .
And, as I mentioned, to totally avoid eval, consider using vkThread(https://github.com/vkiryukhin/vkthread), but I think it's a bit heavy for this problem.

@dbaranoff
Copy link

dbaranoff commented Apr 23, 2024

here's the way to do it without eval. Also, there are similar issues with all the rest config functions

@dboskovic
Copy link
Collaborator

Adding this to the v6 todo. In practice adding support for at least primitive functions here is reasonable as long as we also provide documentation for "full worker" mode. People should be given guidance for making their own workers for more advanced scenarios.

@dboskovic dboskovic added the v6-todo This issue should be handled in the v6 release label Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v6-todo This issue should be handled in the v6 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants