Chore/2.0.0
Types of changes
- [ ] Bug fix (a non-breaking change which fixes an issue)
- [ ] New feature (a non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
https://github.com/Baroshem/nuxt-security/pull/475 https://github.com/Baroshem/nuxt-security/pull/488 https://github.com/Baroshem/nuxt-security/pull/485 https://github.com/Baroshem/nuxt-security/pull/497 https://github.com/Baroshem/nuxt-security/discussions/496 #494 https://github.com/Baroshem/nuxt-security/issues/501
Description
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes (if not applicable, please state why)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nuxt-security | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 19, 2024 11:01am |
@vejja if you agree, I would love to merge this PR and release a brand new 2.0.0 version :)
Hey @Shana-AE could you work on the improvements suggested by @vejja ? :)
@baroshem just a general comment here on providing a regex serializer/deserializer
The official Nuxt docs say that we should not do this:
On balance though, the CORS handler is a native h3 feature, which is supposed to allow Regexes.
I am a bit puzzled at whether regexes are allowed/not allowed in nuxt.config.ts.
Hmm, at this point maybe it would be safer to revert this change and plan it for 2.1.0? What would be your recommendation Sebastien? :)
Hmm, at this point maybe it would be safer to revert this change and plan it for 2.1.0? What would be your recommendation Sebastien? :)
Yes, agree with this Jakub. We would have more time to check with @danielroe on why regexes are not allowed in nuxt.config.ts but allowed in h3 - how they recommend we deal with this
@Baroshem just a general comment here on providing a regex serializer/deserializer The official Nuxt docs say that we should not do this:
On balance though, the CORS handler is a native
h3feature, which is supposed to allow Regexes. I am a bit puzzled at whether regexes are allowed/not allowed innuxt.config.ts.
Thanks for pointing out the documentary :)
I just found that regexp didn't work, and after debugging, I found regexp was serialized to {}. and this is because that runtimeConfig was merged with env and serialized with JSON.stringify() before it was passed to h3. as I mentioned in #497.
I only got the runtimeConfig came from nitropack and got the value from process.env.RUNTIME_CONFIG. I'm just a new user of nuxt, so I didn't know more things about the detail that Why runtimeConfig was serialized and deserialized
I know the problem, and I know the superficial reason, but don't know about the deeper reason, so I just made "it works" through make Regexp can be serialized and restored, though ugly.
I think maybe we should use other things than runtimeConfig to store the config ? or if there is a best practice to make regexp serializable?
Hey @Shana-AE could you work on the improvements suggested by @vejja ? :)
About the test and document, I want to know if there's a better solution to solve this problem. #497 it maybe or should be replaced with a better solution And I want to know if there is a guide about writing test or coverage report?
@Baroshem just a general comment here on providing a regex serializer/deserializer The official Nuxt docs say that we should not do this:
On balance though, the CORS handler is a native
h3feature, which is supposed to allow Regexes. I am a bit puzzled at whether regexes are allowed/not allowed innuxt.config.ts.Thanks for pointing out the documentary :) I just found that regexp didn't work, and after debugging, I found regexp was serialized to
{}. and this is because thatruntimeConfigwas merged withenvand serialized withJSON.stringify()before it was passed toh3. as I mentioned in #497. I only got theruntimeConfigcame fromnitropackand got the value fromprocess.env.RUNTIME_CONFIG. I'm just a new user of nuxt, so I didn't know more things about the detail that WhyruntimeConfigwas serialized and deserialized I know the problem, and I know the superficial reason, but don't know about the deeper reason, so I just made "it works" through makeRegexpcan be serialized and restored, though ugly. I think maybe we should use other things thanruntimeConfigto store the config ? or if there is a best practice to makeregexpserializable?
Understood @Shana-AE, thanks for the explanation I don’t know the exact answer, but we will find out
Here is my attempt on fixing the RegExp issue: https://github.com/Baroshem/nuxt-security/pull/509 Would love to hear your feedback. I noticed that we do not have any CORS test fixture yet. Would be great to add some tests in the future.
UPDATE: I also added a new test fixture for CORS with my PR.
