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 transformHeader can't work with worker (#623) (#761) #953

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

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.

None yet

3 participants