Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Health is a resource status monitoring library.
This is handy when you want to monitor the status of multiple resources using a simple configuration file. For example, if your application requires a web service and a MongoDB database to be available, Health module can monitor those resources and return status ok/fail against each resource along with the response time.
It also supports result caching via ttl attribe of each resource, which is handy when you want to monitor multiple resources at a different interval or to reduce the load on certain resources.
npm install -g health
// use default formatter
var health = new (require('health'))(
setup: [ { name: 'google', uri: 'http://google.com' } ]
);
// use built-in formatter (html, text, or xml)
var health = new (require('health'))(
setup: [ { name: 'google', uri: 'http://google.com' } ],
formatter: 'html'
);
// use custom formatter function
var health = new (require('health'))(
setup: [ { name: 'google', uri: 'http://google.com' } ],
formatter: function (results) {
return results.join('|');
}
);
// check resources
health.check(function (err, result) {
});
From command-line:
health -f html -s health.json check
Health setup is just a simple JSON:
[
{ "name": "Google", "uri", "http://google.com", "statusCodes": [ 200 ] },
{ "name": "GMail", "uri", "https://mail.google.com", "timeout": "1000" },
{ "name": "MongoDB", "uri": "mongodb://somehost:27017", "timeout": 200, "ttl": 30000 },
{ "name": "Temp", "uri": "file:///tmp", "mode": "777", "ttl": 360000 }
]
Attribute | Type | Description | Protocol | Usage | Default | Example |
---|---|---|---|---|---|---|
uri | string | Resource URI to check | All | Mandatory | mongodb://somehost:27017 | |
name | string | Resource name | All | Optional | someapp | |
ttl | number | Cache time to live in milliseconds | All | Optional | 30000 | |
lenient | boolean | Replace fail or error with warning | All | Optional | false | true, false |
group | string | Resource group name, status is set to warning when there's at least one group member having success/warning status, group members status is set to fail/error only when none of the group members has success/warning status | All | Optional | databases, apps, datacenter1 | |
timeout | number | Request/connect timeout in milliseconds | http, https, mongodb | Optional | 500 | |
statusCode | array | An array of acceptable response HTTP status codes | http, https | Optional | [ 200, 409 ] | |
text | array | An array of all texts that must exist in response body, any of them does not exist means status FAIL | http, https | Optional | [ 'foo', 'bar' ] | |
mode | string | 3-digit file/directory mode | file | Optional | 777, 644 |
Build reports:
FAQs
Resource status monitoring library.
The npm package health receives a total of 622,080 weekly downloads. As such, health popularity was classified as popular.
We found that health 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.