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

Same module for Nitro #405

Closed
MickL opened this issue Mar 24, 2024 · 8 comments
Closed

Same module for Nitro #405

MickL opened this issue Mar 24, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@MickL
Copy link

MickL commented Mar 24, 2024

Is your feature request related to a problem? Please describe.

For Nitro there seems to be no module like nuxt-security. I wonder if nuxt-security can be "ported" as Nuxt is basically Nitro.

Btw. if you look into the Nitro docs you might think it doesnt support modules, but in fact it is just not documented: nitrojs/nitro#1862

@MickL MickL added the enhancement New feature or request label Mar 24, 2024
@Baroshem
Copy link
Owner

Hey there,

Thanks for creating this issue.

You are correct. There is no module like NuxtSecurity for Nitro (unless there is one that works differently).

@pi0 what are your thoughts on that?

But honestly, I wont be able to find a time to create and maintain another module. I am happy to provide guidance to someone who can create and maintain it but me myself wont be able to do it.

@MickL
Copy link
Author

MickL commented Mar 25, 2024

I feel like it is a general problem of Nitro that it basically has no modules and all exisiting Nuxt modules are not compatible out of the box.

A security module is urgently needed but I was thinking what if Nuxt releases an amazing Auth module for Nuxt? It will be not available for Nitro as well.

@pi0 Maybe a solution would be great where modules like security or auth are developed for Nitro instead of for Nuxt and then automatically work for both. I guess thats not possibly but brings me back to my request of bringing Nuxt backend api and ssr more apart nuxt/nuxt#26103

@pi0
Copy link
Contributor

pi0 commented Mar 25, 2024

Hi. Everything security related i expect to be directly discussed, developed and maintained within Nitro core only. A security feature for nitro is urgently needed only if there is a clear issue reported within it's context.

@MickL
Copy link
Author

MickL commented Mar 25, 2024

Wouldnt this make nuxt-security redundant then?

I dont see Nitro providing the same features like nuxt-security, e.g. rate limiter, request size limiter, xss validator, xss protection

@vejja
Copy link
Collaborator

vejja commented Mar 28, 2024

Hi @MickL

My understanding is that Nuxt creates a hybrid application, while Nitro creates a server.

As far as Nuxt-Security is concerned, we mostly deal with application security. A good example is CSP: CSP is a set of rules that apply to the client-side and are enforced by the browser. Even though the rules are transmitted by the server, their purpose is to protect the end-user, not to protect the server.

In other words, Nuxt-Security aims at enforcing good security practices for the Nuxt application running in the browser, but does not aim at provide defense against badly-designed code or compromised libraries that could be running in the Nitro server.

Please note that I am using my own mental map of the difference between Nuxt and Nitro here, so I might be mistaken.
I would even venture to say that in my opinion, it is very difficult to understand what is the real scope of Nuxt vs the real scope of Nitro, because the tasks are often shared, there are many runtime inter-dependencies that make the distinction very blurry, and to be honest the terminology can sometimes be quite confusing. Personal opinion here, and for the record I'm a Nuxt fanboy.

@pi0
Copy link
Contributor

pi0 commented Mar 28, 2024

I hope the maintainers of this project don't take my message personally and that I'm just mentioning this because was mentioned in this discussion.

Yes, security depends on context. x-powred-by header is a feature of Nuxt actually!, and for features like CSP headers, we had them built-in since Nuxt 2, I just wish someone helped this to be sooner in the core.

Nitro provides the infrastructure for building secure web applications (for everyone). CSP support is relevant for Nitro but it has to be a built-in feature for it to be usable by higher order layers such as Nuxt.

If someone wants to collaborate on the Nitro side, discussions and issues are always the way to go and welcome.

@MickL
Copy link
Author

MickL commented Mar 28, 2024

I actually use most of nuxt-security to protect my api routes only, and all those things are missing for Nitro:

  • Rate limiter: Prevent brute forcing login credentials
  • Request size limiter: Prevent too huge file uploads
  • XSS Validator: Whitelist what html tags can be party of the body

@Baroshem
Copy link
Owner

Baroshem commented Mar 29, 2024

I agree with @vejja who is doing ana amazing work for the module. The reason we are doing all the work we do for the module is that we are huge fans of Nuxt framework.

I myself am a maintainer of at least four Nuxt modules and there is a reason for that :)

I understand that it could have been useful to have similiar feature for Nitro but I cannot work on it. But I am happy to help with feedback, sharing knowledge and others if someone would be interested in porting the module.

Thanks for all the input guys. I will close this issue as not planned.

@Baroshem Baroshem closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants