Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
connect-datacache
Advanced tools
NodeJS express-session storage for IBM DataCache service.
npm install connect-datacache
Using the DataCache storage connector:
var session = require('express-session');
var DataCacheStore = require('connect-datacache')(session);
app.use(session({
store: new DataCacheStore(options),
secret: 'keyboard cat'
}));
Standard usage for Bluemix environment/dev environment - with fallback on MemoryStore:
dcStore = null;
try {
// by default is looking into bluemix cfenv services
dcStore = new DataCacheStore();
} catch (err) {
// log fallback on memory store for no DataCache service linked to app
}
app.use(session({
store: dcStore,
secret: 'keyboard cat'
}));
Bellow is an example with the full list of parameters - default values for optional ones:
var store = new DataCacheStore(
// required parameters when no custom client provided
restResource: 'http://dcsdomain.bluemix.net/resources/datacaches/{gridName}',
restResourceSecure: 'https://dcsdomain.bluemix.net/resources/datacaches/{gridName}',
gridName: '{gridName}',
username: '{username}',
password: '{password}',
// optional parameters - default values
mapName: '{gridName}',
eviction: 'LUT',
locking: 'optimistic',
contentType: 'application/json',
secure: true,
ttl: 3600,
client: null
);
The datacache client is looking first for DataCache service cfenv values. For the Bluemix NodeJS app with a DataCache service associated the required parameters are read from ENV variables (credentials):
Environment Variables > VCAP_SERVICES
{
"system_env_json": {
"VCAP_SERVICES": {
"DataCache-dedicated": [
{
"credentials": {
"catalogEndPoint": "...",
"restResource": "http://ip-numeric/resources/datacaches/SYS_GENERATED_GRIDNAME",
"restResourceSecure": "https://sdomain.bluemix.net/resources/datacaches/SYS_GENERATED_GRIDNAME",
"gridName": "SYS_GENERATED_GRIDNAME",
"username": "sysGeneratedUsername",
"password": "sysGeneratedPass"
},
"name": "datacache-service-name",
"tags": []
}
]
}
},
}
defaults: VCAP_SERVICES credentials values
Depending on the "secure" value, one of them is required if not found in ENV variables by cfenv.
For a Bluemix application it is required to have the same value as for "gridName". A resource is identified with a complete URI as:
http://secure.domain/resources/datacaches/SYS_GENERATED_GRIDNAME/MAP_NAME.EVICTION.LOCK/SESSION_KEY
For non-Bluemix environments can be customized as a namespace for data.
npm test
npm run coverage
FAQs
Express session connector for IBM DataCache
The npm package connect-datacache receives a total of 1 weekly downloads. As such, connect-datacache popularity was classified as not popular.
We found that connect-datacache 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.