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.
cloud-storage
Advanced tools
Simple wrapper for uploading and deleting files from Google Cloud Storage
Simple wrapper for uploading and deleting files from Google Cloud Storage.
Thanks to @bsphere for https://github.com/bsphere/node-gcs
Sign into the Google Cloud Console site: https://console.developers.google.com
Go to your project and under APIs & auth click on Credentials
Create an Oauth Service Account for your project if you don't already have one
Under the Service Account section copy your Email address (that is your accessId
)
If you do not have a private key, click Generate new key
to generate one (this will download a .p12 file to your computer)
Convert the key to PEM
openssl pkcs12 -in path/to/key.p12 -nodes -nocerts > path/to/key.pem
If prompted for a password enter notasecret
Store this .pem file somewhere (the path to this file is your privateKey
)
var CloudStorage = require('cloud-storage');
var storage = new CloudStorage({
accessId: '1234-abcd@developer.gserviceaccount.com',
privateKey: '/path/to/private/key.pem'
});
// copy a local file or a url
storage.copy('/path/to/something.jpg', 'gs://some-bucket/something.jpg', function(err, url) {
// public url for your file
console.log(url);
});
storage.remove('gs://some-bucket/something.jpg', function(err, success) {
console.log(success);
});
// if you want to get crazy you can pass in options and metadata
var options = {
headers: {
'Cache-Control': 'public, max-age=7200, no-transform',
'X-Goog-Acl': 'bucket-owner-full-control'
},
metadata: {
'width': 100,
'height': 100
},
// remove the original file on disk after it is copied
removeAfterCopy: true
};
storage.copy('/path/to/file.jpg', 'gs://some-bucket/images/file.jpg', options, function(err, url) {
});
var url = storage.getUrl('gs://some-bucket-images/file.jpg')
// expiration time in seconds
var options = {
expiration: 100,
download: true
};
var signedUrl = storage.getSignedUrl('gs://some-bucket-images/file.jpg', options)
FAQs
Simple wrapper for uploading and deleting files from Google Cloud Storage
We found that cloud-storage 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.