New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fastify/secure-session

Package Overview
Dependencies
Maintainers
19
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/secure-session - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0

examples/simple/example-key

30

index.js

@@ -41,3 +41,3 @@ 'use strict'

module.exports = fp(function (fastify, options, next) {
function fastifySecureSession (fastify, options, next) {
let key

@@ -110,3 +110,3 @@ if (options.secret) {

// there is no cookie
log.trace('fastify-secure-session: there is no cookie, creating an empty session')
log.trace('@fastify/secure-session: there is no cookie, creating an empty session')
return null

@@ -122,3 +122,3 @@ }

// the cookie is malformed
log.debug('fastify-secure-session: the cookie is malformed, creating an empty session')
log.debug('@fastify/secure-session: the cookie is malformed, creating an empty session')
return null

@@ -132,3 +132,3 @@ }

// not long enough
log.debug('fastify-secure-session: the cipher is not long enough, creating an empty session')
log.debug('@fastify/secure-session: the cipher is not long enough, creating an empty session')
return null

@@ -139,3 +139,3 @@ }

// the length is not correct
log.debug('fastify-secure-session: the nonce does not have the required length, creating an empty session')
log.debug('@fastify/secure-session: the nonce does not have the required length, creating an empty session')
return null

@@ -157,3 +157,3 @@ }

// unable to decrypt
log.debug('fastify-secure-session: unable to decrypt, creating an empty session')
log.debug('@fastify/secure-session: unable to decrypt, creating an empty session')
return null

@@ -207,7 +207,7 @@ }

// nothing to do
request.log.trace('fastify-secure-session: there is no session or the session didn\'t change, leaving it as is')
request.log.trace('@fastify/secure-session: there is no session or the session didn\'t change, leaving it as is')
next()
return
} else if (session.deleted) {
request.log.debug('fastify-secure-session: deleting session')
request.log.debug('@fastify/secure-session: deleting session')
const tmpCookieOptions = Object.assign(

@@ -224,3 +224,3 @@ {},

request.log.trace('fastify-secure-session: setting session')
request.log.trace('@fastify/secure-session: setting session')
reply.setCookie(

@@ -237,6 +237,3 @@ cookieName,

}
}, {
fastify: '4.x',
name: '@fastify/secure-session'
})
}

@@ -297,1 +294,8 @@ class Session {

}
module.exports = fp(fastifySecureSession, {
fastify: '4.x',
name: '@fastify/secure-session'
})
module.exports.default = fastifySecureSession
module.exports.fastifySecureSession = fastifySecureSession
{
"name": "@fastify/secure-session",
"version": "5.2.0",
"version": "5.3.0",
"description": "Create a secure stateless cookie session for Fastify",
"main": "index.js",
"types": "index.d.ts",
"types": "types/index.d.ts",
"bin": {

@@ -11,3 +11,6 @@ "@fastify/secure-session": "genkey.js"

"scripts": {
"test": "standard && tap test/*.js && tsd"
"lint": "standard",
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "tap test/*.js",
"test:typescript": "tsd"
},

@@ -31,14 +34,13 @@ "repository": {

"devDependencies": {
"@types/node": "^17.0.2",
"@fastify/pre-commit": "^2.0.2",
"@types/node": "^18.0.0",
"cookie": "^0.5.0",
"fastify": "^4.0.0",
"pre-commit": "^1.2.2",
"fastify": "^4.0.0-rc.2",
"standard": "^17.0.0",
"tap": "^16.1.0",
"tsd": "^0.20.0",
"typescript": "^4.0.2"
"tsd": "^0.24.1"
},
"dependencies": {
"@fastify/cookie": "^7.0.0",
"fastify-plugin": "^3.0.0",
"@fastify/cookie": "^8.0.0",
"fastify-plugin": "^4.0.0",
"sodium-native": "^3.0.0"

@@ -48,3 +50,7 @@ },

"access": "public"
}
},
"pre-commit": [
"lint",
"test"
]
}

@@ -25,2 +25,11 @@ # @fastify/secure-session

If you have not previously used this module with npx, you will be prompted to install it,
which with the output redirect will cause the command to wait forever for input.
To avoid this use the `--yes` flag with npx:
```sh
npx --yes @fastify/secure-session > secret-key
```
Then, register the plugin as follows:

@@ -66,3 +75,3 @@

If you enable [`debug` level logging](https://www.fastify.io/docs/latest/Logging/),
If you enable [`debug` level logging](https://www.fastify.io/docs/latest/Reference/Logging/),
you will see what steps the library is doing and understand why a session you

@@ -144,3 +153,3 @@ expect to be there is not present. For extra details, you can also enable `trace`

fastify.listen(3000)
fastify.listen({ port: 3000 })
```

@@ -190,4 +199,4 @@

```
./node_modules/.bin/secure-session-gen-key > secret-key1
./node_modules/.bin/secure-session-gen-key > secret-key2
npx @fastify/secure-session > secret-key1
npx @fastify/secure-session > secret-key2
```

@@ -229,3 +238,3 @@

fastify.listen(3000)
fastify.listen({ port: 3000 })
```

@@ -232,0 +241,0 @@

@@ -53,3 +53,3 @@ 'use strict'

debug: (msg) => {
t.equal(msg, 'fastify-secure-session: the cipher is not long enough, creating an empty session')
t.equal(msg, '@fastify/secure-session: the cipher is not long enough, creating an empty session')
}

@@ -79,5 +79,5 @@ })

debug: (msg) => {
t.equal(msg, 'fastify-secure-session: unable to decrypt, creating an empty session')
t.equal(msg, '@fastify/secure-session: unable to decrypt, creating an empty session')
}
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc