
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
use-express-middleware
Advanced tools
The main purpose of this module is to use express middleware for
authentication in deepstream.io.
If you find other uses for this module, please let me know.
npm install use-express-middleware --save
✓ express-session
✓ passport.initialize()
✓ passport.session()
import Deepstream from 'deepstream.io'
import useExpressMiddleware from 'use-express-middleware'
import expressSession from 'express-session'
import passport from 'passport'
const server = new Deepstream()
// You can define this somewhere in your app and then import it both
// for express and deepstream.
// If you use a store such as redis for you sessions, you'll be able
// to run express and deepstream in two seperate processes and/or on
// two seperate ports if you so please.
const session = expressSession({
...options
})
const middleware = [session, passport.initialize(), passport.session()]
// Using a callback:
server.set('permissionHandler', {
isValidUser(connectionData, authData, callback) {
useExpressMiddleware(connectionData.headers, middleware, (req, res) => {
if(req.user) {
callback(null, req.user.id)
} else {
callback(null, 'open')
}
})
},
canPerformAction(id, message, callback) {
const user = getUserFromId(id) // pseudo code
callback(null, user.isAdmin)
}
})
// Using promises and async/await:
server.set('permissionHandler', {
isValidUser: async (connectionData, authData, callback) => {
const {req, res} = await useExpressMiddleware(connectionData.headers, middleware)
if(req.user) {
callback(null, req.user.id)
} else {
callback(null, 'open')
}
},
...
})
FAQs
Use express middleware outside of express.
We found that use-express-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.