nuxt-security: The RCs break Turnstile with default configuration for nuxt-security

Version

nuxt-security: 2.0.0-rc.6 nuxt: 3.11.2

Reproduction Link

Steps to reproduce

What is Expected?

Any site using Turnstile should just work after adding nuxt-security with default configuration, as stated in the docs.

What is actually happening?

Refused to frame '<URL>' because it violates the following Content Security Policy directive: "frame-src 'self'".

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, so as you suggested @hermes85pl we could go for an opt-in switch :

  • With settingsMode: 'compatibility' (default value), the default settings would ‘always work’ (similar to v1)
  • With settingsMode: 'security', the default settings would prioritize higher security (OWASP/Mozilla recommendations)

This should provide maximum backwards compatibility with v1, avoiding any breaking change.

Opting-in to 'security' might require additional expert knowledge on how to modify Content Security Policy, Permissions Policy and Cross-Origin Isolation. We would cover this in a dedicated section in the docs, together with practical examples. We could also use our own documentation codebase to illustrate how we deploy with ‘security’ mode.

Based on estimates, ‘compatibility’ mode would give a 110/100 score on the Mozilla scanner, while ‘security’ mode would achieve a 120/100 score. Both are rated A+.

Note: The ‘settingsMode’ name is only an illustrative suggestion here

@hermes85pl implementation proposal in #483

We discussed it internally with @vejja and we think that we could revert this change.

From what I understood the change is not that significant if we want to be 100% owasp accurate while we will block several features like scripts, images, domains etc.

@vejja could you update @hermes85pl with your findings?

Also, thanks @hermes85pl for your input. It was really important for us 😃

Hey guys,

Thanks for the discovery and research for this topic. I do agree that based on this example we should update the documentation to the latest state.

In terms of reverting the module to the previous security recommendations, I would be against it. I really love the work you did @vejja on making the application as secure as possible and I would like to keep it this way. I understand the reasoning for not pushing too much on the user but I would focus on providing guides like FAQ on what needs to be done to make a feature work rather than lowering the security by everyone and expect that they will go through the docs and implement all our recommendations by themselves.

If we consider this, then the module is not needed at all because all recomendations are available on the internet, just not in the vue/nuxt form 😉

In summary, I would update the documentation to march the current security recommendations state and provide guides in FAQ that are easily searchable for the problems found by @hermes85pl . This way we would keep the better security by default we wanted for version 2.0.0 and resolve issues with third party services (as they are not that difficult)

Would that make sense to you guys? 😃

That’s a possible solution. We could have 2 modes, one with minimum security settings (similar to v1) which ensures that the application won’t be blocked; and another one with maximum security settings (OWASP/MDN recommended values) with guidance on which options are likely to need modifications.

Although eventually we will need to define which one is the default one. So maybe we want to come back to the more relaxed settings of v1 anyways, and instead provide examples in the docs on how to increase strength from that basis.

@hermes85pl Thanks for your comments

although I would be fine with this approach, I would expect some to get lost and complain

I fully agree. It’s a tough call: security vs useabiity. History shows that when security is too complex, people decide that they won’t implement it. So the outcome of being too strict is usually the opposite of the initial purpose.