Baroshem / nuxt-security

🛡 Automatically configure your app to follow OWASP security patterns and principles by using HTTP Headers and Middleware
https://nuxt-security.vercel.app/
MIT License
820 stars 56 forks source link

Loggers are removed in development mode too #559

Open tratteo opened 4 hours ago

tratteo commented 4 hours ago

Version

nuxt-security: ^2.1.1 nuxt: ^3.14.159

Reproduction Link

Blank project with removeLoggers set to true:

security: {
    removeLoggers: true,
}

Steps to reproduce

Set the removeLoggers entry to true and tun the dev server with run dev. I checked that the NODE_ENV variable is indeed set to development, yet logs are being removed.

What is Expected?

Expected behaviour is that loggers are not removed when the project is in development mode.

What is actually happening?

Loggers are being removed when running development server with run dev. Even with NODE_ENV set to development.

vejja commented 2 hours ago

That's right @tratteo @Baroshem what do you think? Should we have a different default in dev mode?

tratteo commented 2 hours ago

Hi, well I automatically thought that logs removal was happening solely on production. I think that generally logs should be enabled in development mode, but if that is an intended feature that's fine. Thanks for the fast response btw

vejja commented 2 hours ago

No @tratteo you are actually right, sorry for not being clear in my answer I'm wondering whether we should always keep logs in dev mode (ie the option is only valid in production mode), or do we allow the option to be set even in dev mode (ie the option is valid in all environments). If it's the former, it aligns with the previous behavior; if it's the latter, then we can set it via defaults

tratteo commented 2 hours ago

Oh sorry. Well probably being able to set the property in dev mode too would be the best.