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.
gcp-metadata
Advanced tools
The gcp-metadata npm package is a library that allows users to query Google Cloud Platform's (GCP) metadata service for information about the currently running instance and project. This can be useful for applications that need to understand their environment within GCP, such as retrieving instance attributes or project details.
Instance Metadata
Retrieve metadata of the current GCP instance. This includes details like the instance ID, zone, and custom metadata.
const gcpMetadata = require('gcp-metadata');
async function getInstanceMetadata() {
if (await gcpMetadata.isAvailable()) {
const instanceMetadata = await gcpMetadata.instance();
console.log(instanceMetadata);
}
}
getInstanceMetadata();
Project Metadata
Fetch metadata of the current GCP project. This can include project-wide attributes like project ID and numeric project number.
const gcpMetadata = require('gcp-metadata');
async function getProjectMetadata() {
if (await gcpMetadata.isAvailable()) {
const projectMetadata = await gcpMetadata.project();
console.log(projectMetadata);
}
}
getProjectMetadata();
Check Metadata Server Availability
Determine if the GCP metadata server is available and reachable from the instance.
const gcpMetadata = require('gcp-metadata');
async function checkAvailability() {
const isAvailable = await gcpMetadata.isAvailable();
console.log('Metadata service available:', isAvailable);
}
checkAvailability();
The AWS SDK for JavaScript allows developers to interact with AWS services. It includes a module for querying the AWS EC2 instance metadata service, which is similar to what gcp-metadata does for GCP.
Get the metadata from a Google Cloud Platform environment
$ npm install --save gcp-metadata
var gcpMetadata = require('gcp-metadata')
gcpMetadata.instance(function(err, response, metadata) {
// All metadata properties
})
gcpMetadata.instance('hostname', function(err, response, metadata) {
// All metadata properties
})
gcpMetadata.instance({
property: 'tags',
qs: { alt: 'text' }
}, function(err, response, metadata) {
// Tags as newline-delimited list
})
FAQs
Get the metadata from a Google Cloud Platform environment
The npm package gcp-metadata receives a total of 0 weekly downloads. As such, gcp-metadata popularity was classified as not popular.
We found that gcp-metadata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.