Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@mdn/mdn-http-observatory
Advanced tools
The MDN HTTP Observatory is a set of tools to analyze your website and inform you if you are utilizing the many available methods to secure it.
HTTP Observatory is a service that checks web sites for security-relevant headers. It is hosted by MDN Web Docs.
If you just want to scan a host, please head over to https://developer.mozilla.org/en-US/observatory/. If you want to run the code locally or on your premises, continue reading.
Using npx to install the package, simply run
npx @mdn/mdn-http-observatory mdn.dev
If you want to install the package first, use npm to install it globally
npm install --global @mdn/mdn-http-observatory
After that, the mdn-http-observatory-scan
command should be available in your shell. To scan a host, run
mdn-http-observatory-scan mdn.dev
Both methods return a JSON response of the following form:
{
"scan": {
"algorithmVersion": 4,
"grade": "A+",
"error": null,
"score": 105,
"statusCode": 200,
"testsFailed": 0,
"testsPassed": 10,
"testsQuantity": 10,
"responseHeaders": {
...
}
},
"tests": {
"cross-origin-resource-sharing": {
"expectation": "cross-origin-resource-sharing-not-implemented",
"pass": true,
"result": "cross-origin-resource-sharing-not-implemented",
"scoreModifier": 0,
"data": null
},
...
}
}
This needs a postgres database for the API to use as a persistence layer. All scans and results initiated via the API are stored in the database.
Default configuration is read from a default config/config.json
file. See this file for a list of possible configuration options.
Create a configuration file by copying the config/config-example.json
to config/config.json
.
Put in your database credentials into config/config.json
:
{
"database": {
"database": "observatory",
"user": "postgres"
}
}
To initialize the database with the proper tables, use this command to migrate. This is a one-time action, but future code changes might need further database changes, so run this migration every time the code is updated from the repository.
npm run migrate
Finally, start the server by running
npm start
The server is listening on your local interface on port 8080
. You can check the root path by opening http://localhost:8080/ in your browser or curl
the URL. The server should respond with Welcome to the MDN Observatory!
.
Note: We provide these endpoints on our public deployment of HTTP Observatory at https://observatory-api.mdn.mozilla.net/
/api/v2/scan
For integration in CI pipelines or similar applications, a JSON API endpoint is provided. The request rate is limited to one scan per host per api.cooldown
(default: One minute) seconds. If exceeded, a cached result will be returned.
host
hostname (required)POST /api/v2/scan?host=mdn.dev
POST /api/v2/scan?host=google.com
On success, a JSON object is returned, structured like this example response:
{
"id": 77666718,
"details_url": "https://developer.mozilla.org/en-US/observatory/analyze?host=mdn.dev",
"algorithm_version": 4,
"scanned_at": "2024-08-12T08:20:18.926Z",
"error": null,
"grade": "A+",
"score": 105,
"status_code": 200,
"tests_failed": 0,
"tests_passed": 10,
"tests_quantity": 10
}
Note: For a full set of details about the host, use the provided link in the details_url
field.
If an error occurred, an object like this is returned:
{
"error": "invalid-hostname-lookup",
"message": "some.invalid.hostname.dev cannot be resolved"
}
Our project welcomes contributions from any member of our community. To get started contributing, please see our Contributor Guide.
By participating in and contributing to our projects and discussions, you acknowledge that you have read and agree to our Code of Conduct.
If you have any questions, please reach out to us on Mozilla Developer Network.
This project is licensed under the Mozilla Public License 2.0.
FAQs
The MDN HTTP Observatory is a set of tools to analyze your website and inform you if you are utilizing the many available methods to secure it.
The npm package @mdn/mdn-http-observatory receives a total of 33 weekly downloads. As such, @mdn/mdn-http-observatory popularity was classified as not popular.
We found that @mdn/mdn-http-observatory demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.