Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
datacache-client
Advanced tools
NodeJS request-promise based client for IBM Bluemix Data Cache service.
npm install datacache-client
Using the DataCache storage connector:
var DataCacheClient = require('datacache-client');
var dcClient = new DataCacheClient();
// save data to storage
dcClient.put('key-name', {item: 'test'})
.then(function(resp) {
// data saved - continue your logic
debug('Data saved to storage at key "key-name"');
})
.catch(err) {
// something went wrong
debug('Failed to save data to storage');
};
// get data from storage
dcClient.get('key-name')
.then(function(resp) {
// data loaded in resp.body
var obj = resp.body;
debug('Object returned with item = %s', obj.item);
})
.catch(err) {
// no data found
debug('Failed to retrieve data from storage');
};
// destroy data
dcClient.destroy('key-name')
.then(function(resp) {
// data deleted from storage
debug();
})
.catch(err) {
// no data found
debug('Failed to delete data from storage');
};
key - string - name of the key to put data under in DataCache
data - Object|string - Data to be saved to cache service - based on the contentType parameter for the client it saves it as JSON or plain text
ttl - optional - overrides the client Time To Live default value (seconds)
returns: Promise
key - string - key name to be used for retrieval of data from cache storage
returns: Promise - resolved value has the full response (check resolveWithFullResponse parameter for request-promise)
ex: resolved.body - Object retrieved from cache resolved.statusCode - Status code from REST API
key - string - key name to be used for deletion
returns: Promise - resolved value has the full response (check resolveWithFullResponse parameter for request-promise)
Bellow is an example with the full list of parameters - default values for optional ones:
var store = new DataCacheClient({
// 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,
cfenvServiceName: 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.
var dcClient = new DataCacheClient({'cfenvServiceName': 'datacache-service-name'});
PR code needs to pass the lint check and unit test
npm test
PR code should be covered by UT
npm run coverage
The module uses debug npm module - in order to turn the debuging on follow the steps:
Local environment:
$> DEBUG=datacache-client npm start
CF environmment (Bluemix) - using manifest.yml
applications:
- path: .
# ...
env:
DEBUG: datacache-client
services:
- datacache-service-name
FAQs
Node JS request-promise based client for IBM Bluemix Data Cache service.
The npm package datacache-client receives a total of 52 weekly downloads. As such, datacache-client popularity was classified as not popular.
We found that datacache-client 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.