-
Notifications
You must be signed in to change notification settings - Fork 388
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
Security Concern: eval-based Serialization in Seroval Breaks Strict CSP #1825
Comments
SolidStart (and SolidJS) uses seroval for serializing data, but only SolidStart uses the |
I think the OP is more questioning the rationale of sacrificing security for the sake of performance? For some, that tradeoff could be a dealbreaker. |
I'm obviously not an expert in this area, but I wonder if this 100x difference is a significant concern in practice. I haven't noticed if other popular frameworks require I'm not suggesting changing the default serialization method, but I think it would be valuable for some users to have the option to choose a slightly slower serialization method if they prioritize security over speed. |
|
In most benchmarks, Now that I have seen the benchmarks, the performance argument makes less sense to me. Honestly, I'm not convinced I'm going to feel a performance hit if SolidStart used, for example, |
Performance isn't really the main concern, but the response size affects the client (the JSON print of seroval is a lot larger than it's JS output), which in turn affects client performance. In which case, creating another serialization format for the sake of response size, perf and security might be the next other option. (React does this) I'll need to discuss this with Ryan, but for now, the current state is highly desirable. |
Yeah, flexibility for configuration in this area I think is a good compromise. Can easily keep the current behavior as the default and just provide the other methods of serialization alongside it. Hope that conversation goes well. |
I'm not sure whether this is directly related to SolidStart, but I believe here is the best place to get the conversion going.
The issue I'm experiencing is related to the use of
eval
in Seroval, which I believe you use for serializing data in server functions. Use ofeval
is restricted for websites using a strict CSP, which is a huge problem because that's one of the main ways to protect against XSS attacks.There is not a viable solution for this. Two potential fixes are:
'unsafe-eval'
to thescript-src
directive which, as its name implies, is unsafe.The only Issue I found about this is Eventually drop eval? which is closed and it seems there won't be any change. In that Issue, performance is mentioned as the main reason for using
eval
.I get it, you want to be fast, but being fast in this instance comes with a huge cost and that is: basically no serious project can use SolidStart. I'm seriously considering moving to another framework just because of this, even though I'm using SolidStart for any serious project. I don't feel good about a framework that limits using a core security feature like CSP.
I'm surprised this has not come up before. I only found little information about it in Discord. So I'm not entirely sure what's going on and how this can be fixed. But I hope I get an answer here.
Thank you for reading this.
The text was updated successfully, but these errors were encountered: