Comments (4)
@simoneb I still have this problem, but I realise that I haven't provided you with a minimal reproduction, so I'm opening a new issue with a minimal reproduction to show that the problem does exist.
from fastify-secure-session.
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
from fastify-secure-session.
@Tirke I've tried with the following snippet and couldn't reproduce the issue you mentioned. Could you maybe show me where I got it wrong?
Environment
Windows host - NodeJS v16.10.0
Snippet
const Fastify = require('fastify')
const secureSession = require('@fastify/secure-session')
const run = async () => {
const app = Fastify()
await app.register(secureSession, {
secret: 'averylogphrasebiggerthanthirtytwochars',
salt: 'mq9hDxBVDbspDR6n',
})
app.post('/', (request, reply) => {
request.session.set('data', request.body)
reply.send('session set')
})
app.get('/', (request, reply) => {
const data = request.session.get('data')
if (!data) {
reply.code(404).send()
return
}
reply.send(data)
})
app.get('/all', (request, reply) => {
// get all data from session
const data = request.session.data()
if (!data) {
reply.code(404).send()
return
}
reply.send(data)
})
app.listen({ port: 3000 })
}
run()
package.json
{
"dependencies": {
"@fastify/secure-session": "5.3.0",
"fastify": "4.9.2"
}
}
For the sake of completeness I've also run the same snippet using the current versions (NodeJS v18.14.0, fastify
v4.12.0, @fastify/secure-session
v6.0.0) and got the same result.
There's the remote possibility of it being an OS-related issue but, for the reason I expain below, I find it unlikely at this point.
Also, by taking a look at the code of the plugins I couldn't find any piece of code setting the signed
flag in the options
object. With that flag not being set the code shouldn't reach the line where signer
is undefined
. With the default cookie settings (i.e. not passing cookie
in the plugin's options) an empty object is passed to setCookie
. The signed
option should always be undefined
in that scenario.
Maybe I'm missing something but I'm not being able to either identify the issue or reproduce it in order to work on a fix.
from fastify-secure-session.
I can confirm this is also working for me, with an independent repro. @Tirke thanks for the analysis nonetheless, feel free to reopen this issue if for any reason you still cannot workaround the problem you reported.
from fastify-secure-session.
Related Issues (20)
- Add support for typed session data HOT 1
- Add method to get all data in session HOT 2
- How do I set the expiration time for a separate Session HOT 3
- Providing an empty array of keys does not throw an error HOT 2
- "k\" must be crypto_secretbox_KEYBYTES bytes long HOT 2
- `.bin` is not registered when using yarn HOT 6
- New cookie is made on every request, even if session is unchanged HOT 2
- Multiple cookies HOT 2
- Segmentation Fault when using alpine image HOT 7
- Enable multiple cookie sessions HOT 5
- Missing peer dependency on fastify HOT 8
- "No native build was found" HOT 3
- No native build was found - EsBuild AWS Lambda HOT 2
- Release new version to be type compatible with other `@fastify/cookie` modules HOT 1
- Update cookie expiration without updating data HOT 1
- i have been hack HOT 5
- Upgrade @fastify/cookie to 9.1.0 HOT 1
- Considering adding proprietary cookies good practices as Chrome make big changes on cookies in 2024 HOT 2
- typescript types don't work properly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify-secure-session.