Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
redux-persist-cookie-storage
Advanced tools
Redux Persist storage adapter for cookies. Works in the browser and in Node.js with cookie-parser output. This makes it suitable for universal / isomorphic applications.
npm install --save redux-persist-cookie-storage
import { persistStore, autoRehydrate } from 'redux-persist'
import CookieStorage from 'redux-persist-cookie-storage'
const store = createStore(reducer, undefined, autoRehydrate())
// By default, session cookies are used
persistStore(store, { storage: new CookieStorage() })
// Expiration time can be set via options
persistStore(store, { storage: new CookieStorage({
expiration: {
'default': 365 * 86400 // Cookies expire after one year
}
})
})
// Default expiration time can be overridden for specific parts of the store:
persistStore(store, { storage: new CookieStorage({
expiration: {
'default': null, // Session cookies used by default
'storeKey': 600 // State in key `storeKey` expires after 10 minutes
}
})
})
// Read-only mode: Use plain object output of cookie parser
import { persistStore, autoRehydrate } from 'redux-persist'
import CookieStorage from 'redux-persist-cookie-storage'
import cookieParser from 'cookie-parser'
const app = new Express()
app.use(cookieParser())
app.use((req, res) => {
const store = createStore(reducer, undefined, autoRehydrate())
const cookies = req.cookies
persistStore(store, { storage: new CookieStorage({ cookies }) })
})
// Read-write mode: Use actual cookie jar implementation
import { persistStore, autoRehydrate } from 'redux-persist'
import CookieStorage from 'redux-persist-cookie-storage'
import Cookies from 'cookies'
const app = new Express()
app.use(Cookies.express())
app.use((req, res) => {
const store = createStore(reducer, undefined, autoRehydrate())
const cookies = new Cookies(req, res)
persistStore(store, { storage: new CookieStorage({ cookies }) })
})
N.B.: Custom expiration times are not supported server-side at the moment.
npm test
[0.3.0] - 2017-01-18
FAQs
redux-persist storage adapter for cookies
The npm package redux-persist-cookie-storage receives a total of 1,871 weekly downloads. As such, redux-persist-cookie-storage popularity was classified as popular.
We found that redux-persist-cookie-storage 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.